{"record":{"id":"240b082041c0d051","repo":"diegosouzapw/OmniRoute","slug":"chatgpt-cookie-header-is-missing-secure-next-aut","errorCode":null,"errorMessage":"ChatGPT Cookie header is missing __Secure-next-auth.session-token","messagePattern":"ChatGPT Cookie header is missing __Secure-next-auth\\.session-token","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"open-sse/executors/chatgpt-web-codex/storageState.ts","lineNumber":37,"sourceCode":"  };\n}\n\nfunction cookieHeaderValue(raw: string): string {\n  return raw.trim().replace(/^cookie\\s*:\\s*/i, \"\");\n}\n\nfunction parseCookies(raw: string): Array<Record<string, unknown>> {\n  const header = cookieHeaderValue(raw);\n  const pairs = header\n    .split(/;\\s*/)\n    .map((part) => {\n      const separator = part.indexOf(\"=\");\n      return separator > 0 ? [part.slice(0, separator).trim(), part.slice(separator + 1)] : null;\n    })\n    .filter((pair): pair is [string, string] => Boolean(pair?.[0]));\n  if (!pairs.some(([name]) => /^__Secure-next-auth\\.session-token(?:\\.\\d+)?$/.test(name))) {\n    if (header.includes(\";\") || header.includes(\"=\")) {\n      throw new Error(\"ChatGPT Cookie header is missing __Secure-next-auth.session-token\");\n    }\n    pairs.push([\"__Secure-next-auth.session-token\", header]);\n  }\n  return pairs.map(([name, value]) => ({\n    name,\n    value,\n    domain: \".chatgpt.com\",\n    path: \"/\",\n    secure: true,\n    httpOnly: name.startsWith(\"__Secure-\") || name.startsWith(\"__Host-\"),\n    sameSite: \"Lax\",\n  }));\n}\n\nfunction cookieFingerprint(raw: string): string {\n  return createHash(\"sha256\").update(cookieHeaderValue(raw)).digest(\"hex\");\n}\n","sourceCodeStart":19,"sourceCodeEnd":55,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/open-sse/executors/chatgpt-web-codex/storageState.ts#L19-L55","documentation":"Error \"ChatGPT Cookie header is missing __Secure-next-auth.session-token\" thrown in diegosouzapw/OmniRoute.","triggerScenarios":"Thrown at open-sse/executors/chatgpt-web-codex/storageState.ts:37 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"}