earendil-works/pi · error · TypeError
Protocol timestamps must be non-negative integers
Error message
Protocol timestamps must be non-negative integers
What it means
Error "Protocol timestamps must be non-negative integers" thrown in earendil-works/pi.
Source
Thrown at packages/server/src/protocol.ts:137
}
function nonNegativeInteger(value: number | undefined): number | undefined {
if (value === undefined || !Number.isFinite(value)) return undefined;
return Math.max(0, Math.floor(value));
}
function nonNegativeNumber(value: number): number {
return Number.isFinite(value) ? Math.max(0, value) : 0;
}
function identifier(value: string, label: string): string {
if (typeof value !== "string" || value.length === 0) throw new TypeError(`${label} must be a non-empty string`);
return value;
}
function timestamp(value: number): number {
if (!Number.isSafeInteger(value) || value < 0)
throw new TypeError("Protocol timestamps must be non-negative integers");
return value;
}
/** Validate and copy a value from an execution boundary into the protocol's JSON-compatible subset. */
export function toProtocolJsonValue(value: unknown, seen = new Set<object>()): JsonValue {
if (value === null || typeof value === "string" || typeof value === "boolean") return value;
if (typeof value === "number") {
if (!Number.isFinite(value)) throw new TypeError("Protocol JSON numbers must be finite");
return value;
}
if (typeof value !== "object") throw new TypeError(`Unsupported protocol JSON value: ${typeof value}`);
if (seen.has(value)) throw new TypeError("Protocol JSON values must not contain circular references");
const prototype = Object.getPrototypeOf(value);
if (!Array.isArray(value) && prototype !== Object.prototype && prototype !== null) {
throw new TypeError("Protocol JSON objects must be plain objects");
}
seen.add(value);
try {View on GitHub (pinned to 4af9d21d3b)
Solutions
- Use non-negative integer timestamps (for example Date.now()).
When it happens
Trigger: Thrown at packages/server/src/protocol.ts:137 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/46d59a0cb97ab4ec.
Report an issue: GitHub.