diegosouzapw/OmniRoute · error · Error
Invalid cookie JSON at index ${i}: expected an object
Error message
Invalid cookie JSON at index ${i}: expected an object What it means
Error "Invalid cookie JSON at index ${i}: expected an object" thrown in diegosouzapw/OmniRoute.
Source
Thrown at src/lib/providers/webCookieAuth.ts:46
export function parseJsonCookiesToHeader(rawValue: string): string | null {
const trimmed = (rawValue || "").trim();
if (!trimmed || !trimmed.startsWith("[")) return null;
let parsed: unknown;
try {
parsed = JSON.parse(trimmed);
} catch {
return null;
}
if (!Array.isArray(parsed)) return null;
if (parsed.length === 0) return "";
const parts: string[] = [];
for (let i = 0; i < parsed.length; i++) {
const entry = parsed[i];
if (!entry || typeof entry !== "object" || Array.isArray(entry)) {
throw new Error(`Invalid cookie JSON at index ${i}: expected an object`);
}
const record = entry as Record<string, unknown>;
if (typeof record.name !== "string" || !record.name) {
throw new Error(`Invalid cookie JSON at index ${i}: missing required field 'name'`);
}
if (typeof record.value !== "string") {
throw new Error(`Invalid cookie JSON at index ${i}: missing required field 'value'`);
}
parts.push(`${record.name}=${record.value}`);
}
return parts.join("; ");
}
export function normalizeSessionCookieHeader(rawValue: string, defaultCookieName: string): string {
const stripped = stripCookieInputPrefix(rawValue);View on GitHub (pinned to a179ffed5b)
When it happens
Trigger: Thrown at src/lib/providers/webCookieAuth.ts:46 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/d48096c62ab3efa2.
Report an issue: GitHub.