{"record":{"id":"86b45346cf7aab59","repo":"diegosouzapw/OmniRoute","slug":"non-json-graphql-http-res-status-text-slice","errorCode":null,"errorMessage":"Non-JSON GraphQL HTTP ${res.status}: ${text.slice(0, 300)}","messagePattern":"Non-JSON GraphQL HTTP (.+?): (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"open-sse/executors/promptql.ts","lineNumber":252,"sourceCode":"  const res = await fetch(endpoint, {\n    method: \"POST\",\n    headers: {\n      accept: \"application/json\",\n      \"content-type\": \"application/json\",\n      authorization: `Bearer ${token}`,\n      origin: \"https://prompt.ql.app\",\n      referer: \"https://prompt.ql.app/\",\n      \"user-agent\": USER_AGENT,\n    },\n    body: JSON.stringify({ query, variables, operationName }),\n    signal: signal ?? undefined,\n  });\n  const text = await res.text();\n  let json: { data?: T; errors?: Array<{ message?: string }> };\n  try {\n    json = JSON.parse(text) as typeof json;\n  } catch {\n    throw new Error(`Non-JSON GraphQL HTTP ${res.status}: ${text.slice(0, 300)}`);\n  }\n  if (!res.ok) {\n    throw new Error(`GraphQL HTTP ${res.status}: ${text.slice(0, 400)}`);\n  }\n  if (json.errors?.length) {\n    throw new Error(json.errors.map((e) => e.message || \"error\").join(\"; \"));\n  }\n  return json.data as T;\n}\n\n/**\n * Best-effort JWT refresh. Requires browser session cookies (credentials: include\n * in the SPA). Headless callers must store those cookies in providerSpecificData.cookie.\n * **Not fully verified in production** — see PR notes.\n */\nexport async function tryRefreshPromptQlToken(opts: {\n  projectId: string;\n  cookie?: string;","sourceCodeStart":234,"sourceCodeEnd":270,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/open-sse/executors/promptql.ts#L234-L270","documentation":"Error \"Non-JSON GraphQL HTTP ${res.status}: ${text.slice(0, 300)}\" thrown in diegosouzapw/OmniRoute.","triggerScenarios":"Thrown at open-sse/executors/promptql.ts:252 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"}