{"record":{"id":"6a1ced66f41266a7","repo":"diegosouzapw/OmniRoute","slug":"lease-context-invalid","errorCode":"LEASE_CONTEXT_INVALID","errorMessage":"Malformed lease owner","messagePattern":"Malformed lease owner","errorType":"error_code","errorClass":"LeaseContextError","httpStatus":400,"severity":"error","filePath":"src/sse/services/leaseContext.ts","lineNumber":54,"sourceCode":"\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() ?? \"\";\n  if (!/^[1-9]\\d*$/.test(rawGeneration))\n    throw new LeaseContextError(400, \"LEASE_CONTEXT_INVALID\", \"Positive lease generation required\");\n  const generation = Number(rawGeneration);\n  if (!Number.isSafeInteger(generation))\n    throw new LeaseContextError(\n      400,\n      \"LEASE_CONTEXT_INVALID\",\n      \"The lease generation header is invalid\"\n    );\n  return { leaseOwnerId, generation };\n}\n","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/sse/services/leaseContext.ts#L36-L72","documentation":"Error \"Malformed lease owner\" thrown in diegosouzapw/OmniRoute.","triggerScenarios":"Thrown at src/sse/services/leaseContext.ts:54 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"}