{"record":{"id":"fb1f0bc7eda4c57e","repo":"diegosouzapw/OmniRoute","slug":"could-not-create-hyperagent-thread-http-res2-st","errorCode":null,"errorMessage":"Could not create HyperAgent thread (HTTP ${res2.status}). Ensure the session Cookie is valid and not expired.","messagePattern":"Could not create HyperAgent thread \\(HTTP (.+?)\\)\\. Ensure the session Cookie is valid and not expired\\.","errorType":"http","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"open-sse/executors/hyperagent.ts","lineNumber":572,"sourceCode":"    }),\n    signal: signal ?? undefined,\n    redirect: \"manual\",\n  });\n  const loc2 =\n    res2.headers.get(\"location\") ||\n    res2.headers.get(\"Location\") ||\n    res2.headers.get(\"x-middleware-rewrite\") ||\n    \"\";\n  const fromLoc2 = extractThreadIdFromUrl(loc2);\n  if (fromLoc2) return fromLoc2;\n\n  if (res2.status >= 200 && res2.status < 400) {\n    const text = await res2.text().catch(() => \"\");\n    const m = text.match(/\\/thread\\/(cm[a-z0-9]{20,})/i) || text.match(/\"(cm[a-z0-9]{20,})\"/i);\n    if (m) return m[1]!;\n  }\n\n  throw new Error(\n    `Could not create HyperAgent thread (HTTP ${res2.status}). Ensure the session Cookie is valid and not expired.`\n  );\n}\n\n/**\n * Apply model + execution settings on a thread (live SPA does this before chat).\n *\n * - modelId: wire id (e.g. fable-latest — NOT bare \"fable\")\n * - defaultSubagentModel: short family (fable|opus|sonnet|haiku) matching selected model\n * - executionMode: \"auto\" (only non-null value accepted live)\n * - runtimeId: claude-agents-sdk for Claude family\n *\n * Chat body must NOT carry modelId (API returns model_unknown for bare pricing keys).\n */\nexport async function configureHyperAgentThread(\n  cookie: string,\n  threadId: string,\n  opts: {","sourceCodeStart":554,"sourceCodeEnd":590,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/open-sse/executors/hyperagent.ts#L554-L590","documentation":"Error \"Could not create HyperAgent thread (HTTP ${res2.status}). Ensure the session Cookie is valid and not expired.\" thrown in diegosouzapw/OmniRoute.","triggerScenarios":"Thrown at open-sse/executors/hyperagent.ts:572 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"}