{"record":{"id":"5623ff54a2286767","repo":"hcengineering/platform","slug":"unknown-message-format","errorCode":null,"errorMessage":"Unknown message format:","messagePattern":"Unknown message format:","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/hulypulse-client/src/client.ts","lineNumber":206,"sourceCode":"            const id = msg.correlation\n            if (id !== undefined && this.pending.has(id)) {\n              const pending = this.pending.get(id)\n              if (pending !== undefined) {\n                clearTimeout(pending.send_timeout)\n                this.pending.delete(id)\n                if ('error' in msg) {\n                  if (typeof msg.error === 'string' && HulypulseClient.isConnectionLikeError(msg.error)) {\n                    console.warn('Pulse server reported connection-like error; reconnecting')\n                    this.reconnect()\n                  }\n                  pending.reject(new Error(msg.error))\n                } else {\n                  pending.resolve(msg)\n                }\n              }\n            }\n          } else {\n            console.warn('Unknown message format:', msg)\n          }\n        } catch (e) {\n          console.error('Failed to parse message', e)\n        }\n      }\n    })\n  }\n\n  private resubscribe (): void {\n    for (const [key] of this.subscribes) {\n      this.send({ type: 'sub', key }).catch((error) => {\n        console.error(`Resubscription failed for key=${key}:`, error)\n        // throw new Error(`Resubscription failed for key=${key}: ${error.message ?? error}`)\n      })\n    }\n  }\n\n  private startPing (): void {","sourceCodeStart":188,"sourceCodeEnd":224,"githubUrl":"https://github.com/hcengineering/platform/blob/63e28dc96483967b2fc21c881b3f1023c1de7718/packages/hulypulse-client/src/client.ts#L188-L224","documentation":"The hulypulse-client message handler warns 'Unknown message format:' when a WebSocket message parsed successfully but does not match any expected shape (e.g. not a result correlated to a pending request, nor a recognized event/ping structure). The message is dropped; any caller awaiting a response keeps waiting until its own timeout. It indicates a protocol mismatch between server and client.","triggerScenarios":"Server sends a JSON message whose structure matches none of the branches in connect()'s onmessage handler - e.g. unknown 'type', missing required fields, or a response id whose pending promise was already resolved/removed.","commonSituations":"Server and client versions out of sync (server upgraded with new message types); a proxy injecting its own frames; server bug emitting malformed payloads; duplicate responses arriving after the pending entry was cleared.","solutions":["Upgrade hulypulse-client (or server) so both sides speak the same message protocol.","Log the full msg payload on this warning to identify the unexpected shape, then add a handler branch or fix the server.","Check for duplicate/late responses resolving the same pending request twice.","Inspect intermediaries (proxies, gateways) that may rewrite WebSocket frames."],"exampleFix":"// before\nconsole.warn('Unknown message format:', msg)\n// after\nconsole.warn('Unknown message format:', JSON.stringify(msg), 'clientVersion:', VERSION) // capture shape to align protocol","handlingStrategy":"type-guard","validationCode":"// Treat incoming messages defensively before switching on their shape\nfunction isKnownMessage (msg: any): boolean {\n  return msg != null && typeof msg === 'object' && (\n    typeof msg.id === 'number' || typeof msg.type === 'string'\n  )\n}\n","typeGuard":"function isResultMessage (msg: any): msg is { id: number, result: unknown } {\n  return typeof msg?.id === 'number' && 'result' in msg\n}\n","tryCatchPattern":"try {\n  handle(msg)\n} catch (e) {\n  console.warn('Unhandled message', JSON.stringify(msg)) // capture shape for protocol debugging\n}\n","preventionTips":["Keep client and server protocol versions in sync.","Log full payload on unknown formats to extend the handler.","Reject/sanitize messages at proxies between client and server."],"tags":["websocket","protocol","client","message-format"],"backgroundTag":"unknown-message-format","analyzedSha":"63e28dc96483967b2fc21c881b3f1023c1de7718","analyzedAt":"2026-08-29T15:21:27.377Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}