diegosouzapw/OmniRoute · error · Error
Non-JSON GraphQL HTTP
Error message
Non-JSON GraphQL HTTP ${res.status}: ${text.slice(0, 300)} What it means
The PromptQL GraphQL endpoint returned a non-200/JSON body: res.text() could not be parsed as JSON, so the upstream likely served an HTML error page, a redirect, or a gateway failure instead of a GraphQL response. The first 300 characters of the body are embedded to expose the real cause.
Solutions
- Inspect the embedded body slice to identify HTML error pages, WAF blocks, or auth redirects
- Retry with backoff if the endpoint returned a transient gateway error
- Refresh the bearer token if the body suggests an auth redirect
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at open-sse/executors/promptql.ts:252 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/86b45346cf7aab59.
Report an issue: GitHub.
Appendix: source
Thrown at open-sse/executors/promptql.ts:252
const res = await fetch(endpoint, {
method: "POST",
headers: {
accept: "application/json",
"content-type": "application/json",
authorization: `Bearer ${token}`,
origin: "https://prompt.ql.app",
referer: "https://prompt.ql.app/",
"user-agent": USER_AGENT,
},
body: JSON.stringify({ query, variables, operationName }),
signal: signal ?? undefined,
});
const text = await res.text();
let json: { data?: T; errors?: Array<{ message?: string }> };
try {
json = JSON.parse(text) as typeof json;
} catch {
throw new Error(`Non-JSON GraphQL HTTP ${res.status}: ${text.slice(0, 300)}`);
}
if (!res.ok) {
throw new Error(`GraphQL HTTP ${res.status}: ${text.slice(0, 400)}`);
}
if (json.errors?.length) {
throw new Error(json.errors.map((e) => e.message || "error").join("; "));
}
return json.data as T;
}
/**
* Best-effort JWT refresh. Requires browser session cookies (credentials: include
* in the SPA). Headless callers must store those cookies in providerSpecificData.cookie.
* **Not fully verified in production** — see PR notes.
*/
export async function tryRefreshPromptQlToken(opts: {
projectId: string;
cookie?: string;View on GitHub (pinned to a179ffed5b)