diegosouzapw/OmniRoute · error · LeaseContextError
LEASE_CONTEXT_INVALID
LEASE_CONTEXT_INVALID
Error message
Malformed lease owner
What it means
Error "Malformed lease owner" thrown in diegosouzapw/OmniRoute.
Source
Thrown at src/sse/services/leaseContext.ts:54
export function validateExclusiveLeaseKeyConfiguration(
metadata: LeaseKeyMetadata | null | undefined
): void {
if (!isExclusiveLeaseManagedKey(metadata)) return;
if (!metadata?.allowedConnections?.length)
throw new LeaseContextError(
403,
"LEASE_KEY_CONFIGURATION_INVALID",
"Exclusive lease keys require explicit allowed connections"
);
}
export function parseLeaseOwnerHeader(headers: Headers): string {
const leaseOwnerId = headers.get(LEASE_OWNER_HEADER)?.trim() ?? "";
if (!leaseOwnerId)
throw new LeaseContextError(400, "LEASE_CONTEXT_REQUIRED", "Explicit lease owner required");
if (!LEASE_OWNER_PATTERN.test(leaseOwnerId))
throw new LeaseContextError(400, "LEASE_CONTEXT_INVALID", "Malformed lease owner");
return leaseOwnerId;
}
export function parseManagedLeaseRequestContext(headers: Headers): ManagedLeaseRequestContext {
const leaseOwnerId = parseLeaseOwnerHeader(headers);
const rawGeneration = headers.get(LEASE_GENERATION_HEADER)?.trim() ?? "";
if (!/^[1-9]\d*$/.test(rawGeneration))
throw new LeaseContextError(400, "LEASE_CONTEXT_INVALID", "Positive lease generation required");
const generation = Number(rawGeneration);
if (!Number.isSafeInteger(generation))
throw new LeaseContextError(
400,
"LEASE_CONTEXT_INVALID",
"The lease generation header is invalid"
);
return { leaseOwnerId, generation };
}
View on GitHub (pinned to a179ffed5b)
When it happens
Trigger: Thrown at src/sse/services/leaseContext.ts:54 when the library encounters an invalid state.
Common situations: See trigger scenarios.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
AI-assisted analysis of diegosouzapw/OmniRoute@a179ffed5b (2026-08-25).
Data as JSON: /api/errors/6a1ced66f41266a7.
Report an issue: GitHub.