paperclipai/paperclip · error · ServeParseError
non-numeric port in Web key: ${JSON.stringify(key)}
Error message
non-numeric port in Web key: ${JSON.stringify(key)} What it means
ServeParseError from portFromWebKey: the Web key's trailing segment after the last colon is not digits-only, so it cannot be interpreted as a port number. Tailscale's serve status JSON contained an unexpected Web key shape.
Source
Thrown at packages/tailscale-https-broker/src/serve-config.ts:48
constructor(message: string) {
super(message);
this.name = "ServeParseError";
}
}
function isObject(value: unknown): value is Record<string, unknown> {
return typeof value === "object" && value !== null && !Array.isArray(value);
}
/** Extract the trailing `:port` of a `host:port` Web key. */
function portFromWebKey(key: string): number {
const idx = key.lastIndexOf(":");
if (idx <= 0 || idx === key.length - 1) {
throw new ServeParseError(`malformed Web key: ${JSON.stringify(key)}`);
}
const portText = key.slice(idx + 1);
if (!/^[0-9]+$/.test(portText)) {
throw new ServeParseError(`non-numeric port in Web key: ${JSON.stringify(key)}`);
}
return assertCanonicalPort(Number(portText));
}
/**
* Parse serve status JSON into a normalized, port-keyed model. Tolerates extra
* top-level fields (Tailscale evolves its schema) but strictly validates the
* `TCP` and `Web` shapes it depends on.
*/
export function parseServeStatus(json: unknown): ParsedServe {
if (!isObject(json)) {
throw new ServeParseError("serve status must be a JSON object");
}
const entries = new Map<number, ServeEntry>();
const tcp = json.TCP;
const httpsPorts = new Set<number>();
if (tcp !== undefined && tcp !== null) {View on GitHub (pinned to 120ae5428f)
Solutions
- Correct the Web key so its port component is numeric.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at packages/tailscale-https-broker/src/serve-config.ts:48 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of paperclipai/paperclip@120ae5428f (2026-08-18).
Data as JSON: /api/errors/0c7c1b243cac2d15.
Report an issue: GitHub.