{"record":{"id":"77940ca57923ae12","repo":"paperclipai/paperclip","slug":"invalid-handle","errorCode":"invalid_handle","errorMessage":"unknown or stale lease handle","messagePattern":"unknown or stale lease handle","errorType":"error_code","errorClass":"AuthorizationError","httpStatus":null,"severity":"error","filePath":"packages/tailscale-https-broker/src/authorization.ts","lineNumber":78,"sourceCode":"  const ab = Buffer.from(a, \"utf8\");\n  const bb = Buffer.from(b, \"utf8\");\n  if (ab.byteLength !== bb.byteLength) return false;\n  return timingSafeEqual(ab, bb);\n}\n\n/**\n * Resolve the lease a `remove` request is authorized to act on. Requires an\n * exact handle match AND that the requesting peer + runtime UUID match the\n * lease bound at expose time. Runtime A can never remove runtime B's listener.\n */\nexport function authorizeRemoval(\n  leases: readonly LeaseRecord[],\n  request: { runtimeId: string; handle: string },\n  peer: PeerCredentials,\n): LeaseRecord {\n  const lease = leases.find((entry) => handlesEqual(entry.handle, request.handle));\n  if (!lease) {\n    throw new AuthorizationError(\"invalid_handle\", \"unknown or stale lease handle\");\n  }\n  if (lease.runtimeId !== request.runtimeId) {\n    throw new AuthorizationError(\"listener_ownership_mismatch\", \"runtime id does not match lease\");\n  }\n  if (lease.peerUid !== peer.uid || lease.peerGid !== peer.gid) {\n    throw new AuthorizationError(\"listener_ownership_mismatch\", \"peer identity does not match lease\");\n  }\n  return lease;\n}\n","sourceCodeStart":60,"sourceCodeEnd":88,"githubUrl":"https://github.com/paperclipai/paperclip/blob/120ae5428fa29bee300bcf806491cd4d965fbb7c/packages/tailscale-https-broker/src/authorization.ts#L60-L88","documentation":"AuthorizationError('invalid_handle') from authorizeRemoval: no lease in the registry has a handle that timing-safely equals the requested handle. The handle is unknown or refers to a lease that has since been removed/expired, so no lease can be resolved for the remove request.","triggerScenarios":"Thrown at packages/tailscale-https-broker/src/authorization.ts:78 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Acquire a new lease; the handle is unknown or expired."],"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-14T00:17:10.932Z"}