Describe the bug
I try to stream a select query with the parquet format:
const result = await clickhouse.query({
query: sql,
query_params,
format: "Parquet",
});
for await (const chunk of result.stream()) {
// do something
}
while it actually yields (at least some) chunks, @clickhouse/client prints this error on the console:
[2026-03-11T16:45:35.080Z][ERROR][@clickhouse/client][Client] Error while processing the ResultSet.
Arguments: {
session_id: undefined,
role: undefined,
query_id: "65fd505e-e04b-43d5-a728-b961ad2650e3",
}
Caused by: 34 | --errMsgLenStartIdx;
35 | } while (chunk[errMsgLenStartIdx] !== NEWLINE);
36 | const textDecoder = new TextDecoder('utf-8');
37 | const errMsgLen = parseInt(textDecoder.decode(chunk.subarray(errMsgLenStartIdx, -bytesCountAfterErrLenHint)));
38 | if (isNaN(errMsgLen) || errMsgLen <= 0) {
39 | return new Error('there was an error in the stream; failed to parse the message length');
^
error: there was an error in the stream; failed to parse the message length
at extractErrorAtTheEndOfChunk (/.../node_modules/@clickhouse/client-common/dist/utils/stream.js:39:24)
at transform (/.../node_modules/@clickhouse/client/dist/result_set.js:150:41)
at internal:streams/transform:51:18
at writeOrBuffer (internal:streams/writable:283:70)
at internal:streams/writable:249:16
at ondata (internal:streams/readable:456:19)
at emit (node:events:95:22)
at addChunk (internal:streams/readable:265:47)
at readableAddChunkPushByteMode (internal:streams/readable:243:18)
at consumeStream (node:_http_incoming:280:20)
it might depend on my specific query/data, which of course is a bit hard to share. but perhaps this message already shows that something is off.
Environment
- Client version: 1.10.1
- Language version: bun@1.3.10
- OS:
ClickHouse server
- ClickHouse Server version: 26.2-alpine
CREATE TABLE statements for tables involved:
CREATE TABLE IF NOT EXISTS logs
(
chain_id UInt32,
block_number UInt64 CODEC(Delta, ZSTD(3)),
block_hash FixedString(32) CODEC(ZSTD(6)),
timestamp UInt32 CODEC(DoubleDelta, ZSTD(3)),
transaction_hash FixedString(32) CODEC(ZSTD(6)),
transaction_index UInt32 CODEC(Delta, ZSTD(3)),
log_index UInt32 CODEC(Delta, ZSTD(3)),
address FixedString(20) CODEC(ZSTD(6)),
data String CODEC(ZSTD(9)),
topic0 FixedString(32) CODEC(ZSTD(6)),
topic1 Nullable(FixedString(32)) CODEC(ZSTD(6)),
topic2 Nullable(FixedString(32)) CODEC(ZSTD(6)),
topic3 Nullable(FixedString(32)) CODEC(ZSTD(6)),
removed UInt8
) ENGINE = ReplacingMergeTree()
ORDER BY (chain_id, topic0, block_number, log_index, address)
SETTINGS index_granularity = 8192
Describe the bug
I try to stream a select query with the parquet format:
while it actually yields (at least some) chunks,
@clickhouse/clientprints this error on the console:it might depend on my specific query/data, which of course is a bit hard to share. but perhaps this message already shows that something is off.
Environment
ClickHouse server
CREATE TABLEstatements for tables involved: