Skip to content

Fix flashing 500 error when connecting to play.clickhouse.com#8742

Merged
lovincyrus merged 4 commits intomainfrom
cyrus/flashing-500-error-fix
Feb 3, 2026
Merged

Fix flashing 500 error when connecting to play.clickhouse.com#8742
lovincyrus merged 4 commits intomainfrom
cyrus/flashing-500-error-fix

Conversation

@lovincyrus
Copy link
Contributor

@lovincyrus lovincyrus commented Feb 2, 2026

This PR skips database_schemas query when connector has errors. When adding a ClickHouse connector to an uninitialized project, runtimeServiceUnpackEmpty creates the connector resource before the YAML config with credentials is written.

The sidebar auto-expands the new connector and DatabaseExplorer fires /v1/connectors/database_schemas, causing a 500 error since the connector isn't configured yet.

Closes https://linear.app/rilldata/issue/APP-703/flashing-500-error-when-connecting-to-playclickhousecom

CleanShot.2026-02-02.at.14.11.31.mp4

Checklist:

  • Covered by tests
  • Ran it and it works as intended
  • Reviewed the diff before requesting a review
  • Checked for unhandled edge cases
  • Linked the issues it closes
  • Checked if the docs need to be updated. If so, create a separate Linear DOCS issue
  • Intend to cherry-pick into the release branch
  • I'm proud of this work!

@lovincyrus lovincyrus self-assigned this Feb 2, 2026
@lovincyrus lovincyrus marked this pull request as ready for review February 2, 2026 22:14
@royendo
Copy link
Contributor

royendo commented Feb 3, 2026

@lovincyrus unsure from the video as the OLAP connector is closed. Can you confirm that the issue is not showing under the close connector?

Copy link
Contributor

@ericpgreen2 ericpgreen2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving, however:

  1. Can you please run the CI checks?
  2. It seems the connector explorer should open once the connector is reconciled successfully.

@lovincyrus
Copy link
Contributor Author

@lovincyrus unsure from the video as the OLAP connector is closed. Can you confirm that the issue is not showing under the close connector?

This issue is about 500 error not surfacing when user adds their first connector. @royendo

@lovincyrus
Copy link
Contributor Author

Latest demo

CleanShot.2026-02-03.at.14.33.35.mp4

Prevent premature database_schemas API calls for connectors that are not yet configured. When a connector resource exists but has errors (e.g., unconfigured after runtimeServiceUnpackEmpty), the sidebar auto-expands it and triggers database_schemas, causing a 500 error.

Now, useListDatabaseSchemas accepts an enabled parameter, and DatabaseExplorer skips the query when the connector has an errorMessage. The error is displayed in the UI instead, and the query will automatically fire once the connector is configured and errors clear.
When a managed connector is created without configuration, the
database_schemas query would fire immediately and fail with a 500 error.
This was caused by TanStack Query returning cached data even when the
query is disabled, and the template rendering stale error state.

Fix by:
- Only enabling the database_schemas query when connector has valid config
- Preventing template from rendering cached data when query is disabled
- Showing helpful 'Configure connector' message for unconfigured managed connectors
@lovincyrus lovincyrus force-pushed the cyrus/flashing-500-error-fix branch from d5678f1 to ecb84cf Compare February 3, 2026 23:01
When adding a connector on an uninitialized project,
runtimeServiceUnpackEmpty triggers a runtime reset. The SSE
reconnection invalidates all queries, causing AnalyzeConnectors to
fire while the runtime is still initializing. With retry: false
globally, the transient 500 immediately surfaces in the UI. Add
retry logic for server errors so these failures are retried
transparently before displaying an error.
@lovincyrus lovincyrus merged commit e909774 into main Feb 3, 2026
10 checks passed
@lovincyrus lovincyrus deleted the cyrus/flashing-500-error-fix branch February 3, 2026 23:55
lovincyrus added a commit that referenced this pull request Feb 3, 2026
* fix: skip database_schemas query when connector has errors

Prevent premature database_schemas API calls for connectors that are not yet configured. When a connector resource exists but has errors (e.g., unconfigured after runtimeServiceUnpackEmpty), the sidebar auto-expands it and triggers database_schemas, causing a 500 error.

Now, useListDatabaseSchemas accepts an enabled parameter, and DatabaseExplorer skips the query when the connector has an errorMessage. The error is displayed in the UI instead, and the query will automatically fire once the connector is configured and errors clear.

* fix: prevent querying unconfigured managed connectors

When a managed connector is created without configuration, the
database_schemas query would fire immediately and fail with a 500 error.
This was caused by TanStack Query returning cached data even when the
query is disabled, and the template rendering stale error state.

Fix by:
- Only enabling the database_schemas query when connector has valid config
- Preventing template from rendering cached data when query is disabled
- Showing helpful 'Configure connector' message for unconfigured managed connectors

* prettier

* fix: retry transient 500 errors on AnalyzeConnectors query

When adding a connector on an uninitialized project,
runtimeServiceUnpackEmpty triggers a runtime reset. The SSE
reconnection invalidates all queries, causing AnalyzeConnectors to
fire while the runtime is still initializing. With retry: false
globally, the transient 500 immediately surfaces in the UI. Add
retry logic for server errors so these failures are retried
transparently before displaying an error.
lovincyrus added a commit that referenced this pull request Feb 4, 2026
* fix: skip database_schemas query when connector has errors

Prevent premature database_schemas API calls for connectors that are not yet configured. When a connector resource exists but has errors (e.g., unconfigured after runtimeServiceUnpackEmpty), the sidebar auto-expands it and triggers database_schemas, causing a 500 error.

Now, useListDatabaseSchemas accepts an enabled parameter, and DatabaseExplorer skips the query when the connector has an errorMessage. The error is displayed in the UI instead, and the query will automatically fire once the connector is configured and errors clear.

* fix: prevent querying unconfigured managed connectors

When a managed connector is created without configuration, the
database_schemas query would fire immediately and fail with a 500 error.
This was caused by TanStack Query returning cached data even when the
query is disabled, and the template rendering stale error state.

Fix by:
- Only enabling the database_schemas query when connector has valid config
- Preventing template from rendering cached data when query is disabled
- Showing helpful 'Configure connector' message for unconfigured managed connectors

* prettier

* fix: retry transient 500 errors on AnalyzeConnectors query

When adding a connector on an uninitialized project,
runtimeServiceUnpackEmpty triggers a runtime reset. The SSE
reconnection invalidates all queries, causing AnalyzeConnectors to
fire while the runtime is still initializing. With retry: false
globally, the transient 500 immediately surfaces in the UI. Add
retry logic for server errors so these failures are retried
transparently before displaying an error.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants