diegosouzapw/OmniRoute · error · LeaseContextError

LEASE_KEY_CONFIGURATION_INVALID

LEASE_KEY_CONFIGURATION_INVALID

Error message

Exclusive lease keys require explicit allowed connections

What it means

Error "Exclusive lease keys require explicit allowed connections" thrown in diegosouzapw/OmniRoute.

Source

Thrown at src/sse/services/leaseContext.ts:42

    super(message);
  }
}

type LeaseKeyMetadata = {
  scopes?: readonly string[] | null;
  allowedConnections?: readonly string[] | null;
};

export function isExclusiveLeaseManagedKey(metadata: LeaseKeyMetadata | null | undefined): boolean {
  return Array.isArray(metadata?.scopes) && metadata.scopes.includes(LEASE_EXCLUSIVE_SCOPE);
}

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() ?? "";

View on GitHub (pinned to a179ffed5b)

When it happens

Trigger: Thrown at src/sse/services/leaseContext.ts:42 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of diegosouzapw/OmniRoute@a179ffed5b (2026-08-25). Data as JSON: /api/errors/e24c96de7074978e. Report an issue: GitHub.