{"record":{"id":"2c7e467a5f07ef1c","repo":"diegosouzapw/OmniRoute","slug":"amelia-init-failed-res-status","errorCode":null,"errorMessage":"Amelia init failed: ${res.status}","messagePattern":"Amelia init failed: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"open-sse/executors/chipotle.ts","lineNumber":46,"sourceCode":"class AmeliaClient {\n  private session: AmeliaSession | null = null;\n  private ws: import(\"ws\").WebSocket | null = null;\n  private stompConnected = false;\n  private messageCallbacks: Map<string, (msg: string) => void> = new Map();\n  private connectPromise: Promise<void> | null = null;\n\n  async init(): Promise<void> {\n    const res = await fetch(`${BASE_URL}/Amelia/api/init`, {\n      headers: {\n        \"User-Agent\":\n          \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36\",\n        Origin: BASE_URL,\n        Referer: `${BASE_URL}/Amelia/ui/chipotle/chat?embed=iframe`,\n      },\n      redirect: \"manual\",\n    });\n\n    if (!res.ok) throw new Error(`Amelia init failed: ${res.status}`);\n\n    const data = (await res.json()) as {\n      csrfToken: string;\n      user: { userId: string; anonymous: boolean };\n    };\n\n    const setCookies = res.headers.getSetCookie?.() ?? [];\n    const cookieHeader = setCookies.map((c) => c.split(\";\")[0]).join(\"; \");\n\n    this.session = {\n      csrfToken: data.csrfToken,\n      userId: data.user.userId,\n      cookieHeader,\n    };\n  }\n\n  async connect(): Promise<void> {\n    if (!this.session) throw new Error(\"Call init() first\");","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/open-sse/executors/chipotle.ts#L28-L64","documentation":"Error \"Amelia init failed: ${res.status}\" thrown in diegosouzapw/OmniRoute.","triggerScenarios":"Thrown at open-sse/executors/chipotle.ts:46 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"}