paperclipai/paperclip · error · ServeParseError
TCP must be an object
Error message
TCP must be an object
What it means
Shape guard in parseServeStatus: the serve status JSON has a `TCP` field but it is not an object (e.g. an array or scalar). The parser tolerates extra top-level fields but strictly validates TCP/Web shapes it depends on, so a malformed TCP block is rejected.
Source
Thrown at packages/tailscale-https-broker/src/serve-config.ts:67
}
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) {
if (!isObject(tcp)) throw new ServeParseError("TCP must be an object");
for (const [portKey, value] of Object.entries(tcp)) {
if (!/^[0-9]+$/.test(portKey)) {
throw new ServeParseError(`non-numeric TCP port: ${portKey}`);
}
const port = assertCanonicalPort(Number(portKey));
if (!isObject(value)) throw new ServeParseError(`TCP[${portKey}] must be an object`);
if (value.HTTPS === true) httpsPorts.add(port);
if (!entries.has(port)) entries.set(port, { port, https: value.HTTPS === true, handlers: [] });
else entries.get(port)!.https = value.HTTPS === true;
}
}
const web = json.Web;
if (web !== undefined && web !== null) {
if (!isObject(web)) throw new ServeParseError("Web must be an object");
for (const [hostKey, value] of Object.entries(web)) {
const port = portFromWebKey(hostKey);
if (!isObject(value)) throw new ServeParseError(`Web[${hostKey}] must be an object`);View on GitHub (pinned to 120ae5428f)
Solutions
- Fix the serve config so the TCP section is an object keyed by port.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at packages/tailscale-https-broker/src/serve-config.ts:67 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/53ff486442cd6ef4.
Report an issue: GitHub.