Skip to content

fix: report an unreachable warehouse without a traceback - #383

Merged
kvlonge merged 1 commit into
mainfrom
fix/cli-warehouse-unavailable
Nov 11, 2026
Merged

kvlonge merged 1 commit into
mainfrom
fix/cli-warehouse-unavailable

Conversation

@kvlonge

@kvlonge kvlonge commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

Why

When the ClickHouse warehouse refused the connection or its host could not be resolved, sqt plan, build, test and audit ended in an unhandled AdapterWarehouseError traceback instead of a CLI error.

Changes

  • New AdapterUnavailableError, a subclass of AdapterWarehouseError. The ClickHouse driver error translation uses it when the error's cause chain contains a refused connection or a failed host lookup.
  • This check runs before the timeout check, because the request URL in the driver's message can contain setting names such as receive_timeout. Like a traceback, the walk follows __context__ only when no cause is set and the context is not suppressed.
  • The CLI renders it as " could not connect to ClickHouse", with the database and what to check, and exits with status 1.
  • Every existing handler checks isinstance(…, AdapterWarehouseError), so it still catches the subclass.

Verification

  • A regression test drives run_cli dispatch with a translated refused-connection driver error and asserts the message, exit status 1 and no traceback.
  • Translation tests cover a refusal through __cause__, a failed host lookup through __context__, a refusal whose URL names a timeout setting, a suppressed context and a reset connection. The last two stay generic AdapterWarehouseError.
  • Against a real clickhouse_connect client pointed at a closed port and at an unresolvable host, both errors translate to AdapterUnavailableError, and sqt plan/sqt build on the example project print the message instead of a traceback.
  • make check-ci and the full unit suite (1911 tests) pass.

A refused connection or an unresolvable warehouse host now classifies as
AdapterUnavailableError, and the CLI prints which command could not
connect and what to check, exiting with status 1, instead of an
unhandled AdapterWarehouseError traceback.
@kvlonge
kvlonge enabled auto-merge (squash) November 11, 2026 08:16
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Deploying sqltide with  Cloudflare Pages  Cloudflare Pages

Latest commit: a34ba3b
Status: ✅  Deploy successful!
Preview URL: https://70791f4b.sqltide.pages.dev
Branch Preview URL: https://wip-cli-warehouse-unavailabl-75op.sqltide.pages.dev

View logs

@kvlonge
kvlonge merged commit 7bbd8a3 into main Nov 11, 2026
17 checks passed
@kvlonge
kvlonge deleted the fix/cli-warehouse-unavailable branch November 11, 2026 08:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant