{"record":{"id":"7afba10fde900b47","repo":"earendil-works/pi","slug":"this-kind-message-decoder-has-failed","errorCode":null,"errorMessage":"${this.kind} message decoder has failed","messagePattern":"(.+?) message decoder has failed","errorType":"exception","errorClass":"ProtocolValidationError","httpStatus":null,"severity":"error","filePath":"packages/protocol/src/codec.ts","lineNumber":103,"sourceCode":"\treturn encodeProtocolMessage(message, parseServerMessage, \"server\", options);\n}\n\nclass ValidatedMessageDecoder<T> {\n\tprivate failed = false;\n\tprivate readonly frames: FrameDecoder;\n\tprivate readonly kind: string;\n\tprivate readonly maxFrameLength: number;\n\tprivate readonly parse: (candidate: unknown) => T;\n\n\tconstructor(kind: string, parse: (candidate: unknown) => T, options?: FrameDecoderOptions) {\n\t\tthis.frames = new FrameDecoder(options);\n\t\tthis.kind = kind;\n\t\tthis.maxFrameLength = options?.maxFrameLength ?? DEFAULT_MAX_FRAME_LENGTH;\n\t\tthis.parse = parse;\n\t}\n\n\tpush(chunk: Uint8Array): T[] {\n\t\tif (this.failed) throw new ProtocolValidationError(`${this.kind} message decoder has failed`);\n\t\ttry {\n\t\t\tconst messages: T[] = [];\n\t\t\tfor (const frame of this.frames.push(chunk)) {\n\t\t\t\tmessages.push(this.parse(decodeCbor(frame, { maxByteLength: this.maxFrameLength })));\n\t\t\t}\n\t\t\treturn messages;\n\t\t} catch (error) {\n\t\t\tthis.failed = true;\n\t\t\tif (error instanceof ProtocolValidationError) throw error;\n\t\t\tthrow new ProtocolValidationError(`Invalid ${this.kind} protocol frame: ${boundedErrorMessage(error)}`);\n\t\t}\n\t}\n\n\tend(): void {\n\t\tif (this.failed) throw new ProtocolValidationError(`${this.kind} message decoder has failed`);\n\t\ttry {\n\t\t\tthis.frames.end();\n\t\t} catch (error) {","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/earendil-works/pi/blob/4af9d21d3b4d664e4a29fcabfec85171077248e3/packages/protocol/src/codec.ts#L85-L121","documentation":"Error \"${this.kind} message decoder has failed\" thrown in earendil-works/pi.","triggerScenarios":"Thrown at packages/protocol/src/codec.ts:103 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["The decoder stream failed; discard it, create a new decoder, and resynchronize the connection."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4af9d21d3b4d664e4a29fcabfec85171077248e3","analyzedAt":"2026-08-24T13:07:14.692Z","schemaVersion":2},"datasetVersion":"2026-08-24T17:17:21.512Z"}