Bug description

Reproduction steps: 1. Run Superset with "docker compose" on macbook 2. Login to Settings -> Database connections and add mysql database named MySQL 3. Go to "SQL Lab" , select postgres database "examples" , select schema "public", select any table and run test query on that, it is SUCCESS. 4. Go to "SQL Lab" , select newly added mysql database "MySQL" , ERROR appears 5. "SQL Lab" , select postgres database "examples" , select schema "public" (which was success in step 3) ERROR 6. Once the ERROR appears none of the Databases work, the only options is to Logout and Login again.

I tried the same steps with Clickhouse DB as well with same results. So behaviour is not mysql specific.

Screenshots/recordings

Error on Step 4 Image

Error on Step 5 Image

Superset version

5.0.0

Python version

3.9

Node version

16

Browser

Safari

Additional context

Post Step 4 Logs from container "superset_app" Main errors: "GET /api/v1/database/mysql-MySQL-5/function_names/ HTTP/1.1" 404 - "PUT /tabstateview/3 HTTP/1.1" 400 -

2025-07-11 10:24:02 2025-07-11 04:54:02,908:WARNING:superset.views.error_handling:HTTPException 2025-07-11 10:24:02 Traceback (most recent call last): 2025-07-11 10:24:02 File "/app/.venv/lib/python3.11/site-packages/flask/app.py", line 1484, in full_dispatch_request 2025-07-11 10:24:02 rv = self.dispatch_request() 2025-07-11 10:24:02 ^^^^^^^^^^^^^^^^^^^^^^^ 2025-07-11 10:24:02 File "/app/.venv/lib/python3.11/site-packages/flask/app.py", line 1458, in dispatch_request 2025-07-11 10:24:02 self.raise_routing_exception(req) 2025-07-11 10:24:02 File "/app/.venv/lib/python3.11/site-packages/flask/app.py", line 1440, in raise_routing_exception 2025-07-11 10:24:02 raise request.routing_exception # type: ignore 2025-07-11 10:24:02 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2025-07-11 10:24:02 File "/app/.venv/lib/python3.11/site-packages/flask/ctx.py", line 353, in match_request 2025-07-11 10:24:02 result = self.url_adapter.match(return_rule=True) # type: ignore 2025-07-11 10:24:02 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2025-07-11 10:24:02 File "/app/.venv/lib/python3.11/site-packages/werkzeug/routing/map.py", line 629, in match 2025-07-11 10:24:02 raise NotFound() from None 2025-07-11 10:24:02 werkzeug.exceptions.NotFound: 404 Not Found: The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again. 2025-07-11 10:24:02 2025-07-11 04:54:02,910:INFO:werkzeug:192.168.65.1 - - [11/Jul/2025 04:54:02] "GET /api/v1/database/mysql-MySQL-5/function_names/ HTTP/1.1" 404 - 2025-07-11 10:24:07 2025-07-11 04:54:07,914:INFO:werkzeug:192.168.65.1 - - [11/Jul/2025 04:54:07] "PUT /tabstateview/3 HTTP/1.1" 400 - 2025-07-11 10:24:20 2025-07-11 04:54:20,476:INFO:werkzeug:192.168.65.1 - - [11/Jul/2025 04:54:20] "GET /api/v1/me/ HTTP/1.1" 200 -

Logs from superset_nginx 2025-07-11 10:24:02 192.168.65.1 - - [11/Jul/2025:04:54:02 +0000] "GET /api/v1/database/mysql-MySQL-5/function_names/ HTTP/1.1" 404 264 [1] "http://localhost/sqllab/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.5 Safari/605.1.15" "-" 2025-07-11 10:24:07 192.168.65.1 - - [11/Jul/2025:04:54:07 +0000] "PUT /tabstateview/3 HTTP/1.1" 400 983 [2] "http://localhost/sqllab/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.5 Safari/605.1.15" "-"

Post Step 5

Logs from container "superset_app" post Step 5 Main Errors "GET /api/v1/database/postgresql-examples-1/function_names/ HTTP/1.1" 404 - "PUT /tabstateview/3 HTTP/1.1" 400 - 2025-07-11 10:25:52 2025-07-11 04:55:52,069:WARNING:superset.views.error_handling:HTTPException 2025-07-11 10:25:52 Traceback (most recent call last): 2025-07-11 10:25:52 File "/app/.venv/lib/python3.11/site-packages/flask/app.py", line 1484, in full_dispatch_request 2025-07-11 10:25:52 rv = self.dispatch_request() 2025-07-11 10:25:52 ^^^^^^^^^^^^^^^^^^^^^^^ 2025-07-11 10:25:52 File "/app/.venv/lib/python3.11/site-packages/flask/app.py", line 1458, in dispatch_request 2025-07-11 10:25:52 self.raise_routing_exception(req) 2025-07-11 10:25:52 File "/app/.venv/lib/python3.11/site-packages/flask/app.py", line 1440, in raise_routing_exception 2025-07-11 10:25:52 raise request.routing_exception # type: ignore 2025-07-11 10:25:52 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2025-07-11 10:25:52 File "/app/.venv/lib/python3.11/site-packages/flask/ctx.py", line 353, in match_request 2025-07-11 10:25:52 result = self.url_adapter.match(return_rule=True) # type: ignore 2025-07-11 10:25:52 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2025-07-11 10:25:52 File "/app/.venv/lib/python3.11/site-packages/werkzeug/routing/map.py", line 629, in match 2025-07-11 10:25:52 raise NotFound() from None 2025-07-11 10:25:52 werkzeug.exceptions.NotFound: 404 Not Found: The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again. 2025-07-11 10:25:52 2025-07-11 04:55:52,074:INFO:werkzeug:192.168.65.1 - - [11/Jul/2025 04:55:52] "GET /api/v1/database/postgresql-examples-1/function_names/ HTTP/1.1" 404 - 2025-07-11 10:25:57 2025-07-11 04:55:57,067:INFO:werkzeug:192.168.65.1 - - [11/Jul/2025 04:55:57] "PUT /tabstateview/3 HTTP/1.1" 400 - 2025-07-11 10:26:21 2025-07-11 04:56:21,655:INFO:werkzeug:127.0.0.1 - - [11/Jul/2025 04:56:21] "GET /health HTTP/1.1" 200 -

Logs from superset_nginx 2025-07-11 10:25:52 192.168.65.1 - - [11/Jul/2025:04:55:52 +0000] "GET /api/v1/database/postgresql-examples-1/function_names/ HTTP/1.1" 404 264 [2] "http://localhost/sqllab/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.5 Safari/605.1.15" "-" 2025-07-11 10:25:57 192.168.65.1 - - [11/Jul/2025:04:55:57 +0000] "PUT /tabstateview/3 HTTP/1.1" 400 999 [1] "http://localhost/sqllab/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.5 Safari/605.1.15" "-"

Checklist

  • [x] I have searched Superset docs and Slack and didn't find a solution to my problem.
  • [x] I have searched the GitHub issue tracker and didn't find a similar bug report.
  • [x] I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.

Comment From: dosubot[bot]

Hi @msshroff! I'm Dosu and I’m helping the superset team.

This is a known bug in Superset's SQL Lab state management. When you switch databases, sometimes the frontend stores the database ID as a string (like mysql-MySQL-5 or postgresql-examples-1) instead of a numeric ID. This causes all subsequent API calls for any database to fail with 404 errors, breaking SQL Lab for all databases until you reload or log out and back in. The backend expects a numeric database ID, so when it receives a string, it can't find the database and returns a 404. This also explains the 400 errors on /tabstateview/—the backend can't insert the invalid database ID into the tab state model, so it rejects the request.

This bug is not specific to MySQL or Clickhouse; it can happen with any database if the frontend state gets corrupted. There is no robust recovery except to reload or log out/in, which resets the frontend state and restores functionality. Defensive type checking is needed on both the frontend and backend to prevent this, but as of now, no fix has landed in recent releases or PRs. More details and similar reports are discussed here.

For now, if you hit this state, reload the page or log out and back in to reset SQL Lab. Avoid using non-standard or slug-like database names if possible, and keep an eye on future releases for a fix.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Join Discord Share on X

Comment From: msshroff

Thanks @dosu.

But because of this error I am not able to access the newly added MySQL or Clickhouse DBs in the SQL Lab at all. As soon i select anything other that "examples" database this error appears.

Is there are workaround for that?

Comment From: dosubot[bot]

There’s a built-in workaround that can help: in SQL Lab, append ?reset=1 to the URL (so it looks like .../sqllab/?reset=1). This will show a “Reset state” button in the left sidebar—clicking it will fully reset SQL Lab’s state, clearing out any corrupted data and restoring database access. Note that this will close all open tabs and discard any unsaved queries or work, so save anything important first.

This is currently the only reliable way to recover from this bug until the upstream fix is merged and released (details).

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Join Discord Share on X

Comment From: msshroff

@dosu.

The “Reset state” button press fails with below error .

The Unexpected error TypeError: Object.values requires that input parameter not be null or undefined

Unexpected error
TypeError: Object.values requires that input parameter not be null or undefined

AppContainer@
HotLoaderLazyWrapper
ErrorBoundary@
EmotionCssPropInternal
main
Content
EmotionCssPropInternal
div
Layout
Suspense
Route@
Switch@
LocationProvider
Route@
QueryParamProvider
DynamicPluginProvider
EmbeddedUiConfigProvider
FlashProvider
DndProvider
Provider
MotionWrapper
ProviderChildren
ConfigProvider
ThemeProvider
bound SupersetThemeProvider
SupersetThemeProvider
RootContextProviders
Router@
BrowserRouter@
App
AppContainer@
HotExportedApp@

Comment From: dosubot[bot]

This error happens because the frontend state (Redux/localStorage) is already corrupted or incomplete, so when the "Reset state" button tries to reinitialize SQL Lab, it ends up with missing keys like queries, tables, or databases. When the UI tries to use Object.values on these, it throws the TypeError you saw. This is a known bug in Superset's state management (details).

The only reliable workaround is to manually clear your browser's localStorage (specifically the redux key), then reload the page or log out and back in. This will force Superset to fully reset SQL Lab state and should restore access to your databases. There isn't an in-app fix until a code change is released—keep an eye on future updates for a permanent solution.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Join Discord Share on X

Comment From: msshroff

@dosu.

Even after doing "manually clear your browser's localStorage" It solved the issue with default postgres database "examples" But still i am not able to work with newly added MySQL and Clickhouse database connections. It gives same error

Comment From: dosubot[bot]

This is a confirmed bug in SQL Lab: when you select a new database, the frontend sometimes sends a string like "mysql-MySQL-5" as the database ID instead of the required integer. This breaks all API calls for that database and any others until you reset the state. The only reliable workaround is to reload or log out/in, but for new databases, this bug will keep recurring until the fix is released (details).

If clearing localStorage lets the "examples" database work but not new ones, it's almost certainly this bug. There is no in-app workaround until the patch is merged and released. If you need a temporary fix, you could try applying the patch from PR #33955 manually.

Also, make sure your Docker image includes the required drivers for MySQL and Clickhouse. For MySQL, add mysqlclient or mysql-connector-python to requirements-local.txt and rebuild your Docker image. For Clickhouse, ensure the relevant driver is installed as well (reference). If the connection test in the UI fails, check for missing drivers or system dependencies.

If your connections pass the test but SQL Lab still fails, it's the dbId bug and only the default database will work until the fix lands. If you need more help, let me know if the "Test Connection" in the UI succeeds for your MySQL and Clickhouse databases.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Join Discord Share on X

Comment From: msshroff

@dosu.

I do not think this is "missing drivers or system dependencies." issue

As in the SQL Lab screen I see the names of the Schema populated correctly for both Clickhouse and MySQL, so we can safely assume that it is able to connect the the dataabses correctly.

Also i could not find "Test Connection" in the UI Can you please help me with it?

Thanks Mehul S.

Comment From: dosubot[bot]

Seeing schema names in SQL Lab does mean Superset was able to connect to your MySQL and Clickhouse databases and fetch metadata, so basic connectivity is working.

The "Test Connection" button is part of the database connection modal in Superset 5.0.0. To find it: go to Settings → Database Connections, click "Add" (or edit an existing connection), and in the modal that appears, look for the "Basic" tab. If you are using the SQLAlchemy URI form, you should see a "Test connection" button near the bottom of the form. Clicking it will send your connection details to the backend and show a success or error message based on the result. This feature is confirmed to be present and working in 5.0.0 (see implementation).

If you don't see the button, possible reasons include: not being in "add" or "edit" mode, not using the SQLAlchemy URI form, or a UI bug. If the button is missing, saving the connection and checking for errors, or confirming that schemas appear in SQL Lab (as you did), are good proxies for connectivity.

Let me know if you still can't find the button or if you see something different in your UI.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Join Discord Share on X

Comment From: msshroff

I an buidling Superset from the master branch so assuming it is Superset 5.0.0

I do not see "Test connection" when i edit the connection for MySQL I do not see "Test connection" when i edit the connection for Clickhouse

Screenshots attached for reference.

Image Image

Can you please check?