earendil-works/pi · error · TypeError

PiClient maxFrameLength must be an integer between 1 and 429

Error message

PiClient maxFrameLength must be an integer between 1 and 4294967295

What it means

Error "PiClient maxFrameLength must be an integer between 1 and 4294967295" thrown in earendil-works/pi.

Source

Thrown at packages/client/src/connection.ts:54

	onMessage(message: Exclude<ServerMessage, { type: "hello" | "hello_error" }>): void;
	onStateChange(change: ConnectionStateChange): void;
}

export class Connection {
	readonly #options: ConnectionOptions;
	readonly #maxFrameLength: number;
	#lifecycle: ConnectionLifecycle = { state: "disconnected" };
	#sequence = 0;

	constructor(options: ConnectionOptions) {
		this.#options = options;
		this.#maxFrameLength = options.maxFrameLength ?? DEFAULT_MAX_FRAME_LENGTH;
		if (
			!Number.isSafeInteger(this.#maxFrameLength) ||
			this.#maxFrameLength <= 0 ||
			this.#maxFrameLength > MAX_UINT32
		) {
			throw new TypeError(`PiClient maxFrameLength must be an integer between 1 and ${MAX_UINT32}`);
		}
	}

	get state(): ConnectionState {
		return this.#lifecycle.state;
	}

	get maxFrameLength(): number {
		return this.#maxFrameLength;
	}

	connect(): Promise<ServerSnapshot> {
		if (this.#lifecycle.state !== "disconnected") {
			return Promise.reject(new PiDisconnectedError(`PiClient is already ${this.#lifecycle.state}`));
		}
		const id = ++this.#sequence;
		const handshake = createPromiseResolvers<ServerSnapshot>();
		this.#lifecycle = {

View on GitHub (pinned to 4af9d21d3b)

Solutions

  1. Set maxFrameLength to an integer between 1 and 4294967295.

When it happens

Trigger: Thrown at packages/client/src/connection.ts:54 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/a00a75849988e05a. Report an issue: GitHub.