cube-js/cube · error

Request of {} bytes exceeds the maximum message size of {} b

Error message

Request of {} bytes exceeds the maximum message size of {} bytes. Reduce the size of the query, e.g. by sending fewer or smaller inline tables, or raise CUBESTORE_TRANSPORT_MAX_MESSAGE_SIZE.

What it means

Cube Store's WebSocket HTTP transport checks each incoming message against CUBESTORE_TRANSPORT_MAX_MESSAGE_SIZE and replies with a per-message Error frame (naming the failed message) rather than killing the connection, so other in-flight messages survive.

Source

Thrown at rust/cubestore/cubestore/src/http/mod.rs:526

                                            let message_buffer = msg.into_bytes();
                                            let http_message = match root_as_http_message(&message_buffer) {
                                                Err(e) => {
                                                    error!("Websocket message deserialization error: {:?}", e);
                                                    continue;
                                                },
                                                Ok(http_message) => http_message,
                                            };

                                            let message_id = http_message.message_id();
                                            let connection_id = http_message.connection_id().map(|s| s.to_string());

                                            // Refused here rather than by the transport so the
                                            // answer can name the message it belongs to and the
                                            // connection survives for everything else in flight
                                            // on it. See TRANSPORT_SIZE_HEADROOM.
                                            if message_buffer.len() > max_message_size {
                                                let error = format!(
                                                    "Request of {} bytes exceeds the maximum message size of {} bytes. Reduce the size of the query, e.g. by sending fewer or smaller inline tables, or raise CUBESTORE_TRANSPORT_MAX_MESSAGE_SIZE.",
                                                    message_buffer.len(), max_message_size
                                                );
                                                error!("Websocket message too large: {}", error);
                                                let send_res = web_socket.send(
                                                    Message::binary(HttpMessage { message_id, connection_id, command: HttpCommand::Error { error } }.bytes())
                                                ).await;
                                                if let Err(e) = send_res {
                                                    error!("Websocket message send error: {:?}", e)
                                                }
                                                continue;
                                            }

                                            match HttpMessage::read(http_message).await {
                                                Err(e) => {
                                                    error!("Websocket message read error: {:?}", e);

                                                    let send_res = web_socket.send(
                                                        Message::binary(HttpMessage { message_id, connection_id, command: HttpCommand::Error { error: e.to_string() } }.bytes())

View on GitHub (pinned to 7d981676b3)

Solutions

  1. Raise CUBESTORE_TRANSPORT_MAX_MESSAGE_SIZE on the Cube Store side to match client limits.
  2. Reduce the request size: smaller inline tables, chunked sends.
  3. Keep client and server size limits consistent (client limit should be <= server limit).

Example fix

// before
CUBESTORE_TRANSPORT_MAX_MESSAGE_SIZE=1073741824  # client raised to 4GB, server still 1GB
// after
CUBESTORE_TRANSPORT_MAX_MESSAGE_SIZE=4294967296
Defensive patterns

Strategy: try-catch

Try / catch

// Client side: handle the Error frame for the failed message id
match msg {
  HttpCommand::Error { error, .. } if error.contains("exceeds the maximum message size") => {
    // chunk the request or raise CUBESTORE_TRANSPORT_MAX_MESSAGE_SIZE
  }
  _ => {}
}

Prevention

When it happens

Trigger: A client sends a request frame over the Cube Store WebSocket whose byte length exceeds the server's max_message_size — e.g. queries carrying large inline tables.

Common situations: Client CUBEJS_CUBESTORE_MAX_MESSAGE_SIZE raised above the server's CUBESTORE_TRANSPORT_MAX_MESSAGE_SIZE, large batch inserts/upload payloads, defaults stricter than the workload needs.

Related errors


AI-assisted analysis of cube-js/cube@7d981676b3 (2026-09-02). Data as JSON: /api/errors/2826e97a2fb0d728. Report an issue: GitHub.