Skip to content

[client-v2] Error handling in JSON format #3280

Description

@chernser

There is a good source of knowledge how errors are handled when used one of JSON format ClickHouse/clickhouse-js#1085

We need:

  • analyze how it is done in JavaScript client
  • implement similar

Activity

  1. added
    client
    api-diagnostics
    on Oct 30, 2026
  2. polyglotAI-bot commented on Nov 27, 2026

    @polyglotAI-bot
    Collaborator

    Recommendation: Keep open — implementation needed
    Two open items cover parts of this: PR #3097 (the tagged error frame of a mid-stream error, in all formats; it has merge conflicts with main) and #3220 (the {"exception": ...} row of JSONEachRow on ClickHouse 25.8). Decide which parts this issue tracks.

    • Category: Feature
    • Classification: impact: none · area: API & diagnostics (errors in JSON formats)
    • Status on main: Not supported on main — on main (8480ca001) with ClickHouse 26.11.2.4, Client.query with JSONEachRow: an error before output gives a correct ServerException (code 395 and the server text); an error after 50 rows gives ConnectionClosedException: Premature end of chunk coded message body, with no server code or text, with and without response compression.
    • Breaking change: No — callers get a ServerException in place of a transport exception or a data row.
    • Duplicates / related: [client-v2] Mid-stream server error with response compression: ServerException message starts with result rows, not the server text #3439: a mid-stream error with response compression can give a ServerException whose message starts with result rows.

    Analysis: client-v2 reads a server error only when the response starts with it: the X-ClickHouse-Exception-Code header or an error status (HttpAPIClientHelper.java:848-849, :872). No code in client-v2 reads X-ClickHouse-Exception-Tag, the __exception__ frame, or an exception key in JSON output. Not run: ClickHouse 24.8, where an error before output also comes as JSON (ClickHouse/clickhouse-js#1085).

    Automated triage by Polyglot AI. A maintainer makes the final decision.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    api-diagnosticsclientenhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions