earendil-works/pi · error · FrameError

Truncated frame at end of stream

Error message

Truncated frame at end of stream

What it means

Error "Truncated frame at end of stream" thrown in earendil-works/pi.

Source

Thrown at packages/protocol/src/framing.ts:163

	end(): void {
		if (this.state === "ended") throw new FrameError("Frame decoder has ended");
		if (this.state === "failed") throw new FrameError("Frame decoder has failed");
		if (this.headerLength !== 0 || this.expectedPayloadLength !== undefined) {
			this.fail("Truncated frame at end of stream");
		}
		this.state = "ended";
	}

	private fail(message: string): never {
		this.state = "failed";
		this.headerLength = 0;
		this.payloadBlocks = [];
		this.currentPayloadBlock = undefined;
		this.currentPayloadBlockLength = 0;
		this.expectedPayloadLength = undefined;
		this.payloadLength = 0;
		throw new FrameError(message);
	}
}

View on GitHub (pinned to 4af9d21d3b)

Solutions

  1. The stream ended mid-frame; ensure the writer flushed complete frames before closing.

When it happens

Trigger: Thrown at packages/protocol/src/framing.ts:163 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/7d8786cab88865e5. Report an issue: GitHub.