{"record":{"id":"9c325cf02cba7cba","repo":"cube-js/cube","slug":"cube-store-missed-message-id-httpmessage-messag","errorCode":null,"errorMessage":"Cube Store missed message id: ${httpMessage.messageId()}","messagePattern":"Cube Store missed message id: (.+?)","errorType":"exception","errorClass":"QueryError","httpStatus":null,"severity":"error","filePath":"packages/cubejs-cubestore-driver/src/WebSocketConnection.ts","lineNumber":384,"sourceCode":"                // eslint-disable-next-line no-restricted-syntax\n                for (const key of Object.keys(webSocket.sentMessages)) {\n                  webSocket.sentMessages[key].reject(e);\n                }\n              }\n            }, this.retryWaitTime());\n          }\n\n          if (webSocket === this.webSocket) {\n            this.webSocket = null;\n          }\n        });\n        webSocket.on('message', async (msg: Buffer) => {\n          const buf = new flatbuffers.ByteBuffer(msg);\n          const httpMessage = HttpMessage.getRootAsHttpMessage(buf);\n\n          const resolver = webSocket.sentMessages[httpMessage.messageId()];\n          if (!resolver) {\n            throw new QueryError(`Cube Store missed message id: ${httpMessage.messageId()}`);\n          }\n\n          delete webSocket.sentMessages[httpMessage.messageId()];\n\n          if (httpMessage.commandType() === HttpCommand.HttpError) {\n            resolver.reject(new QueryError(`${httpMessage.command(new HttpError())?.error()}`));\n            this.closeIfDrained(webSocket);\n            return;\n          }\n\n          try {\n            const nativeResMsg = await parseCubestoreResultMessage(msg);\n            resolver.resolve(nativeResMsg);\n          } catch (e) {\n            resolver.reject(e);\n          }\n\n          this.closeIfDrained(webSocket);","sourceCodeStart":366,"sourceCodeEnd":402,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/packages/cubejs-cubestore-driver/src/WebSocketConnection.ts#L366-L402","documentation":"When a message arrives on the WebSocket, the driver looks up a resolver in webSocket.sentMessages by messageId; if none exists the response is unknown and the driver throws a QueryError. This indicates the reply does not match any outstanding request — a protocol desynchronization between Cube and Cube Store.","triggerScenarios":"Cube Store sends a message whose id was never sent by the driver, a duplicate response, or a late response whose resolver entry was already deleted; typically after reconnects or a server restart mid-connection.","commonSituations":"Cube Store process restart while the client keeps the socket; duplicated messages through proxies; internal driver/server message-id mismatches on version skew.","solutions":["Restart the connection/driver to resynchronize the message protocol","Check for Cube Store restarts or multiple clients sharing one connection","Align Cube Store and driver versions","Capture logs (messageId) and report if reproducible with matching versions"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// cannot pre-validate server-initiated message ids; ensure single owner of the socket\nif (!driver) throw new Error('driver not initialized');","typeGuard":"const isMissedMessage = (e) => /Cube Store missed message id/.test(e?.message ?? '');","tryCatchPattern":"try {\n  return await driver.query(sql, params);\n} catch (e) {\n  if (isMissedMessage(e)) {\n    await reconnectDriver(); // resynchronize the protocol\n    return driver.query(sql, params);\n  }\n  throw e;\n}","preventionTips":["Never share one WebSocketConnection across multiple client processes","Detect Cube Store restarts and proactively reconnect","Keep driver and Cube Store versions in sync","Avoid duplicated-delivery intermediaries on the socket path"],"tags":["cubestore","websocket","protocol-error"],"backgroundTag":"missed-message-id","analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}