{"record":{"id":"e24c96de7074978e","repo":"diegosouzapw/OmniRoute","slug":"lease-key-configuration-invalid","errorCode":"LEASE_KEY_CONFIGURATION_INVALID","errorMessage":"Exclusive lease keys require explicit allowed connections","messagePattern":"Exclusive lease keys require explicit allowed connections","errorType":"error_code","errorClass":"LeaseContextError","httpStatus":403,"severity":"error","filePath":"src/sse/services/leaseContext.ts","lineNumber":42,"sourceCode":"    super(message);\n  }\n}\n\ntype LeaseKeyMetadata = {\n  scopes?: readonly string[] | null;\n  allowedConnections?: readonly string[] | null;\n};\n\nexport function isExclusiveLeaseManagedKey(metadata: LeaseKeyMetadata | null | undefined): boolean {\n  return Array.isArray(metadata?.scopes) && metadata.scopes.includes(LEASE_EXCLUSIVE_SCOPE);\n}\n\nexport function validateExclusiveLeaseKeyConfiguration(\n  metadata: LeaseKeyMetadata | null | undefined\n): void {\n  if (!isExclusiveLeaseManagedKey(metadata)) return;\n  if (!metadata?.allowedConnections?.length)\n    throw new LeaseContextError(\n      403,\n      \"LEASE_KEY_CONFIGURATION_INVALID\",\n      \"Exclusive lease keys require explicit allowed connections\"\n    );\n}\n\nexport function parseLeaseOwnerHeader(headers: Headers): string {\n  const leaseOwnerId = headers.get(LEASE_OWNER_HEADER)?.trim() ?? \"\";\n  if (!leaseOwnerId)\n    throw new LeaseContextError(400, \"LEASE_CONTEXT_REQUIRED\", \"Explicit lease owner required\");\n  if (!LEASE_OWNER_PATTERN.test(leaseOwnerId))\n    throw new LeaseContextError(400, \"LEASE_CONTEXT_INVALID\", \"Malformed lease owner\");\n  return leaseOwnerId;\n}\n\nexport function parseManagedLeaseRequestContext(headers: Headers): ManagedLeaseRequestContext {\n  const leaseOwnerId = parseLeaseOwnerHeader(headers);\n  const rawGeneration = headers.get(LEASE_GENERATION_HEADER)?.trim() ?? \"\";","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/sse/services/leaseContext.ts#L24-L60","documentation":"Error \"Exclusive lease keys require explicit allowed connections\" thrown in diegosouzapw/OmniRoute.","triggerScenarios":"Thrown at src/sse/services/leaseContext.ts:42 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d","analyzedAt":"2026-08-25T18:35:09.898Z","schemaVersion":2},"datasetVersion":"2026-08-25T21:54:21.419Z"}