earendil-works/pi · error · ProtocolValidationError

Invalid server protocol message

Error message

Invalid server protocol message

What it means

Error "Invalid server protocol message" thrown in earendil-works/pi.

Source

Thrown at packages/protocol/src/codec.ts:50

	try {
		if (Array.isArray(value)) return value.every((item) => isProtocolValue(item, false, ancestors));
		if (Object.getPrototypeOf(value) !== Object.prototype) return false;
		return Object.values(value).every((item) => isProtocolValue(item, true, ancestors));
	} finally {
		ancestors.delete(value);
	}
}

export function parseClientMessage(value: unknown): ClientMessage {
	if (!isProtocolValue(value) || !Check(ClientMessageSchema, value)) {
		throw new ProtocolValidationError("Invalid client protocol message");
	}
	return value;
}

export function parseServerMessage(value: unknown): ServerMessage {
	if (!isProtocolValue(value) || !Check(ServerMessageSchema, value)) {
		throw new ProtocolValidationError("Invalid server protocol message");
	}
	return value;
}

function boundedErrorMessage(error: unknown): string {
	if (!(error instanceof Error)) return "Unknown codec error";
	return error.message.length <= 500 ? error.message : `${error.message.slice(0, 497)}...`;
}

function encodeProtocolMessage<T>(
	value: T,
	parse: (candidate: unknown) => T,
	kind: string,
	options?: FrameDecoderOptions,
): Uint8Array {
	const validated = parse(value);
	try {
		const maxFrameLength = options?.maxFrameLength ?? DEFAULT_MAX_FRAME_LENGTH;

View on GitHub (pinned to 4af9d21d3b)

Solutions

  1. The server sent a malformed protocol message; verify the server and client versions match.

When it happens

Trigger: Thrown at packages/protocol/src/codec.ts:50 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/7da6d02b1db3acb4. Report an issue: GitHub.