diegosouzapw/OmniRoute · error · Error

ChatGPT Cookie header is missing __Secure-next-auth.session-

Error message

ChatGPT Cookie header is missing __Secure-next-auth.session-token

What it means

Error "ChatGPT Cookie header is missing __Secure-next-auth.session-token" thrown in diegosouzapw/OmniRoute.

Source

Thrown at open-sse/executors/chatgpt-web-codex/storageState.ts:37

  };
}

function cookieHeaderValue(raw: string): string {
  return raw.trim().replace(/^cookie\s*:\s*/i, "");
}

function parseCookies(raw: string): Array<Record<string, unknown>> {
  const header = cookieHeaderValue(raw);
  const pairs = header
    .split(/;\s*/)
    .map((part) => {
      const separator = part.indexOf("=");
      return separator > 0 ? [part.slice(0, separator).trim(), part.slice(separator + 1)] : null;
    })
    .filter((pair): pair is [string, string] => Boolean(pair?.[0]));
  if (!pairs.some(([name]) => /^__Secure-next-auth\.session-token(?:\.\d+)?$/.test(name))) {
    if (header.includes(";") || header.includes("=")) {
      throw new Error("ChatGPT Cookie header is missing __Secure-next-auth.session-token");
    }
    pairs.push(["__Secure-next-auth.session-token", header]);
  }
  return pairs.map(([name, value]) => ({
    name,
    value,
    domain: ".chatgpt.com",
    path: "/",
    secure: true,
    httpOnly: name.startsWith("__Secure-") || name.startsWith("__Host-"),
    sameSite: "Lax",
  }));
}

function cookieFingerprint(raw: string): string {
  return createHash("sha256").update(cookieHeaderValue(raw)).digest("hex");
}

View on GitHub (pinned to a179ffed5b)

When it happens

Trigger: Thrown at open-sse/executors/chatgpt-web-codex/storageState.ts:37 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/240b082041c0d051. Report an issue: GitHub.