earendil-works/pi · error · ProtocolValidationError

Invalid client protocol message

Error message

Invalid client protocol message

What it means

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

Source

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

function isProtocolValue(value: unknown, optionalProperty = false, ancestors = new Set<object>()): boolean {
	if (value === undefined) return optionalProperty;
	if (value === null || typeof value === "boolean" || typeof value === "number" || typeof value === "string") {
		return true;
	}
	if (typeof value !== "object" || ancestors.has(value)) return false;
	ancestors.add(value);
	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,

View on GitHub (pinned to 4af9d21d3b)

Solutions

  1. The client sent a malformed protocol message; fix the client to follow the protocol schema.

When it happens

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