earendil-works/pi · error · ProtocolValidationError
${this.kind} message decoder has failed
Error message
${this.kind} message decoder has failed What it means
Error "${this.kind} message decoder has failed" thrown in earendil-works/pi.
Source
Thrown at packages/protocol/src/codec.ts:103
return encodeProtocolMessage(message, parseServerMessage, "server", options);
}
class ValidatedMessageDecoder<T> {
private failed = false;
private readonly frames: FrameDecoder;
private readonly kind: string;
private readonly maxFrameLength: number;
private readonly parse: (candidate: unknown) => T;
constructor(kind: string, parse: (candidate: unknown) => T, options?: FrameDecoderOptions) {
this.frames = new FrameDecoder(options);
this.kind = kind;
this.maxFrameLength = options?.maxFrameLength ?? DEFAULT_MAX_FRAME_LENGTH;
this.parse = parse;
}
push(chunk: Uint8Array): T[] {
if (this.failed) throw new ProtocolValidationError(`${this.kind} message decoder has failed`);
try {
const messages: T[] = [];
for (const frame of this.frames.push(chunk)) {
messages.push(this.parse(decodeCbor(frame, { maxByteLength: this.maxFrameLength })));
}
return messages;
} catch (error) {
this.failed = true;
if (error instanceof ProtocolValidationError) throw error;
throw new ProtocolValidationError(`Invalid ${this.kind} protocol frame: ${boundedErrorMessage(error)}`);
}
}
end(): void {
if (this.failed) throw new ProtocolValidationError(`${this.kind} message decoder has failed`);
try {
this.frames.end();
} catch (error) {View on GitHub (pinned to 4af9d21d3b)
Solutions
- The decoder stream failed; discard it, create a new decoder, and resynchronize the connection.
When it happens
Trigger: Thrown at packages/protocol/src/codec.ts:103 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of earendil-works/pi@4af9d21d3b (2026-08-24).
Data as JSON: /api/errors/7afba10fde900b47.
Report an issue: GitHub.