cube-js/cube · error · MessageTooLargeError
Cube Store closed the connection: ${closeReason || 'message
Error message
Cube Store closed the connection: ${closeReason || 'message size exceeds the maximum message size Cube Store accepts'}. Reduce the size of the query and of the inline tables it sends, or raise CUBESTORE_TRANSPORT_MAX_MESSAGE_SIZE or CUBESTORE_TRANSPORT_MAX_FRAME_SIZE on the Cube Store side. What it means
Error "Cube Store closed the connection: ${closeReason || 'message size exceeds the maximum message size Cube Store accepts'}. Reduce the size of the query and of the inline tables it sends, or raise CUBESTORE_TRANSPORT_MAX_MESSAGE_SIZE or CUBESTORE_TRANSPORT_MAX_FRAME_SIZE on the Cube Store side." thrown in cube-js/cube.
Source
Thrown at packages/cubejs-cubestore-driver/src/WebSocketConnection.ts:291
if (pending.length) {
// Cube Store names the size and the limit that refused it here,
// which is strictly better than the generic wording, so it
// replaces it rather than being appended to it. Peer-supplied
// text lands in an error a user reads, so control characters are
// folded out and the trailing full stop is normalised rather than
// assumed absent. A peer that closes with 1009 and no reason --
// an intermediary, or an older Cube Store -- keeps the generic
// wording, which is the only reason it still exists.
const closeReason = reason?.length
// eslint-disable-next-line no-control-regex
? `${reason}`.replace(/[\u0000-\u001F\u007F]+/g, ' ').replace(/\s*\.?\s*$/, '')
: '';
const fatalError = webSocket.fatalError || (
// Cube Store refused a message that didn't fit into its limits.
code === MESSAGE_TOO_BIG_CLOSE_CODE ? new MessageTooLargeError(
`Cube Store closed the connection: ${closeReason || 'message size exceeds the maximum message size Cube Store accepts'}. `
+ 'Reduce the size of the query and of the inline tables it sends, or raise '
+ 'CUBESTORE_TRANSPORT_MAX_MESSAGE_SIZE or CUBESTORE_TRANSPORT_MAX_FRAME_SIZE '
+ 'on the Cube Store side.'
) : null
);
// The connection multiplexes messages and an oversized one can't be
// attributed -- `ws` drops the frame before its message id is read
// -- so every message in flight gets one more round, which answers
// the innocent ones and usually leaves the offender alone to be
// named next time. That includes a message that was alone in
// flight: `fatalError` says an oversized frame was seen on this
// socket, not which query produced it, and it can be the response
// to a query rejected on an earlier round that was still on the
// wire. Whatever is still in flight after its round is failed
// regardless: an offender whose response keeps arriving before the
// other answers would otherwise be re-sent forever.
if (fatalError) {
// eslint-disable-next-line no-restricted-syntaxView on GitHub (pinned to 7d981676b3)
Solutions
- Reduce the query size and the size of inline tables sent over the WebSocket connection
- Raise CUBESTORE_TRANSPORT_MAX_MESSAGE_SIZE and CUBESTORE_TRANSPORT_MAX_FRAME_SIZE on the Cube Store side to accommodate the payload
- If the close carried a peer-supplied reason, prefer that specific wording over the generic size-exceeded hypothesis
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at packages/cubejs-cubestore-driver/src/WebSocketConnection.ts:291 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of cube-js/cube@7d981676b3 (2026-09-02).
Data as JSON: /api/errors/83dca8af70b39382.
Report an issue: GitHub.