paperclipai/paperclip · error · ProtocolError
invalid or missing field: ${field}
Error message
invalid or missing field: ${field} What it means
requireStringField guard in the protocol decoder: a mandatory string field (requestId, runtimeId, or handle) is missing, not a string, or fails its field-specific regex. The code (malformed_request, invalid_runtime_id, etc.) selects the protocol error; the message names the offending field.
Source
Thrown at packages/tailscale-https-broker/src/protocol.ts:70
}
function asObject(value: unknown): Record<string, unknown> {
if (typeof value !== "object" || value === null || Array.isArray(value)) {
throw new ProtocolError("malformed_request", "request must be a JSON object");
}
return value as Record<string, unknown>;
}
function requireStringField(
obj: Record<string, unknown>,
field: string,
re: RegExp,
code: ProtocolError["code"],
requestId: string | null,
): string {
const value = obj[field];
if (typeof value !== "string" || !re.test(value)) {
throw new ProtocolError(code, `invalid or missing field: ${field}`, requestId);
}
return value;
}
/**
* Decode a raw request frame (utf-8 JSON) into a validated BrokerRequest.
* Throws ProtocolError on any violation; never mutates state.
*/
export function decodeRequest(frame: Buffer | string): BrokerRequest {
const buf = typeof frame === "string" ? Buffer.from(frame, "utf8") : frame;
if (buf.byteLength === 0) {
throw new ProtocolError("malformed_request", "empty request frame");
}
if (buf.byteLength > MAX_REQUEST_BYTES) {
throw new ProtocolError("malformed_request", "request frame exceeds size limit");
}
let parsed: unknown;View on GitHub (pinned to 120ae5428f)
Solutions
- Include the named field with a valid value in the request object.
- Check the protocol schema for the expected field names and types.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at packages/tailscale-https-broker/src/protocol.ts:70 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/3cf1e2b85c1143d9.
Report an issue: GitHub.