Skip to content

fix(cli): report an unreachable ClickHouse endpoint without the driver's log line - #385

Merged
kvlonge merged 2 commits into
mainfrom
fix/refused-connection-log
Nov 11, 2026
Merged

kvlonge merged 2 commits into
mainfrom
fix/refused-connection-log

Conversation

@kvlonge

@kvlonge kvlonge commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

Why

When ClickHouse is unreachable, the CLI prints a clean error, but the ClickHouse client library still logs a bare "Unexpected Http Driver Exception" line above it. That line carries no host, port or cause and reads like a crash.

Changes

  • The error now names the endpoint and the cause on one line, for example Plan could not connect to ClickHouse at 127.0.0.1:8123: connection refused, host not found or temporary DNS failure. IPv6 hosts are bracketed and a refusing proxy is named as a proxy.
  • The driver's line is dropped only while a refused connection or unresolvable host is being handled, and is kept at DEBUG when DEBUG logging is enabled for that logger. Other driver logging is unchanged.
  • The adapter exception gains endpoint and reason attributes; its message text is unchanged.

Verification

  • Subprocess tests assert the exact stderr and exit code for a refused port, an unresolvable host and the DEBUG case.
  • Unit cases for filter scope (refused, unresolved, reset, no active error, other messages) and for IPv6, proxy and DNS wording.
  • clippy, fmt, ruff, ty, fensu, boundary and shape-surface checks clean. Full suites left to CI.

Closes CHI-1214

…r's log line

A refused connection or unresolvable host printed clickhouse_connect's
own 'Unexpected Http Driver Exception' warning above SQLTide's error.
SQLTide's message now carries what that line stood for, the endpoint and
a short cause:

  Plan could not connect to ClickHouse at db.example.com:8123: connection refused

The translated AdapterUnavailableError records the endpoint and reason,
and a logging filter on the driver's HTTP client logger demotes that one
line to DEBUG while a refused or unresolved connection is being handled:
it is dropped unless DEBUG is enabled for the logger. Other driver
records, and the same line for other transport failures, are unchanged.

Refs: CHI-1214
…ures

Follow-up to the unreachable ClickHouse message:

- an IPv6 host is shown as [::1]:8123 rather than ::1:8123
- when urllib3 reports a ProxyError, the endpoint is the configured proxy,
  so the message reads 'could not connect to ClickHouse through proxy
  <host>:<port>' instead of naming the proxy as ClickHouse
- a socket.gaierror with errno EAI_AGAIN is reported as a temporary DNS
  failure; other resolution errors stay 'host not found'. The errno is
  used, not the message text

Refs: CHI-1214
@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: 8fa5f38
Status: ✅  Deploy successful!
Preview URL: https://c11a0842.sqltide.pages.dev
Branch Preview URL: https://fix-refused-connection-log.sqltide.pages.dev

View logs

@kvlonge
kvlonge merged commit 1cf96b8 into main Nov 11, 2026
17 checks passed
@kvlonge
kvlonge deleted the fix/refused-connection-log branch November 11, 2026 11:10
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