{"record":{"id":"318d0b013fd8bc81","repo":"paperclipai/paperclip","slug":"listener-ownership-mismatch","errorCode":"listener_ownership_mismatch","errorMessage":"runtime id does not match lease","messagePattern":"runtime id does not match lease","errorType":"error_code","errorClass":"AuthorizationError","httpStatus":null,"severity":"error","filePath":"packages/tailscale-https-broker/src/authorization.ts","lineNumber":81,"sourceCode":"  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":63,"sourceCodeEnd":88,"githubUrl":"https://github.com/paperclipai/paperclip/blob/120ae5428fa29bee300bcf806491cd4d965fbb7c/packages/tailscale-https-broker/src/authorization.ts#L63-L88","documentation":"AuthorizationError from authorizeRemoval: a lease matching the handle was found, but the requesting runtime's UUID differs from the runtime bound at expose time. Enforces runtime isolation — runtime A can never remove runtime B's listener even with a leaked handle.","triggerScenarios":"Thrown at packages/tailscale-https-broker/src/authorization.ts:81 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use the runtime id that owns the lease, or acquire a fresh lease for this runtime."],"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"}