{"record":{"id":"a0ebb1d58ae3a5af","repo":"paperclipai/paperclip","slug":"key-must-be-a-non-negative-integer","errorCode":null,"errorMessage":"${key} must be a non-negative integer","messagePattern":"(.+?) must be a non-negative integer","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/tailscale-https-broker/src/config.ts","lineNumber":35,"sourceCode":"  runtimeUid: number;\n  /**\n   * Operator-declared ports the broker must never mutate, parsed from\n   * `BROKER_PROTECTED_PORTS` (PAP-17285). Empty when unset.\n   */\n  protectedPorts: number[];\n}\n\nfunction requireEnv(env: NodeJS.ProcessEnv, key: string): string {\n  const value = env[key];\n  if (!value || value.trim().length === 0) {\n    throw new Error(`missing required env: ${key}`);\n  }\n  return value;\n}\n\nfunction requireUid(env: NodeJS.ProcessEnv, key: string): number {\n  const raw = requireEnv(env, key);\n  if (!/^[0-9]+$/.test(raw)) throw new Error(`${key} must be a non-negative integer`);\n  return Number(raw);\n}\n\nexport function loadHostConfig(env: NodeJS.ProcessEnv): BrokerHostConfig {\n  const config: BrokerHostConfig = {\n    socketPath: env.BROKER_SOCKET_PATH ?? \"/run/paperclip-tailscale-broker/broker.sock\",\n    registryPath: env.BROKER_REGISTRY_PATH ?? \"/var/lib/paperclip-tailscale-broker/registry.json\",\n    auditPath: env.BROKER_AUDIT_PATH ?? \"/var/log/paperclip-tailscale-broker/audit.log\",\n    tailscaleBinPath: env.BROKER_TAILSCALE_BIN ?? \"/usr/bin/tailscale\",\n    nodeIdentity: requireEnv(env, \"BROKER_NODE_IDENTITY\"),\n    serviceUid: requireUid(env, \"BROKER_SERVICE_UID\"),\n    serviceGid: requireUid(env, \"BROKER_SERVICE_GID\"),\n    runtimeUid: requireUid(env, \"BROKER_RUNTIME_UID\"),\n    // Throws on a malformed list so the broker refuses to start rather than\n    // starting up silently protecting nothing (PAP-17285).\n    protectedPorts: parseProtectedPorts(env.BROKER_PROTECTED_PORTS),\n  };\n  if (!config.tailscaleBinPath.startsWith(\"/\")) {","sourceCodeStart":17,"sourceCodeEnd":53,"githubUrl":"https://github.com/paperclipai/paperclip/blob/120ae5428fa29bee300bcf806491cd4d965fbb7c/packages/tailscale-https-broker/src/config.ts#L17-L53","documentation":"requireUid guard in loadHostConfig: a UID/GID env var (BROKER_SERVICE_UID, BROKER_SERVICE_GID, BROKER_RUNTIME_UID) contains characters other than digits, i.e. not a canonical non-negative integer. Startup aborts because privilege-separating IDs must be exact.","triggerScenarios":"Thrown at packages/tailscale-https-broker/src/config.ts:35 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set the named config key to a non-negative integer (0 or greater).","Remove the key from the environment/config to use the default value."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"120ae5428fa29bee300bcf806491cd4d965fbb7c","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}