continuedev/continue · critical · Error
Response body is null
Error message
Response body is null
What it means
Generic wrapper thrown when anything inside the keyJson setup path throws — JSON.parse failure, fromJSON errors, or the inner non-JWT check being caught and rewrapped. The original exception is swallowed, so the real cause (usually malformed JSON or missing fields) is hidden.
Source
Thrown at core/commands/slash/built-in-legacy/http.ts:25
description: "Call an HTTP endpoint to serve response",
run: async function* ({ ide, llm, input, params, fetch }) {
const url = params?.url;
if (!url) {
throw new Error("URL is not defined in params");
}
const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
input: removeQuotesAndEscapes(input),
}),
});
// Stream the response
if (response.body === null) {
throw new Error("Response body is null");
}
for await (const chunk of streamResponse(response)) {
yield chunk;
}
},
};
export default HttpSlashCommand;
View on GitHub (pinned to 5522c6f44c)
Solutions
- Validate keyJson parses before constructing: JSON.parse it yourself and log the real error
- Check the secret round-trips intact (compare length/hash against the original file)
- Store the key as a file and pass keyFile instead of keyJson
- Inspect for BOM or smart-quote characters introduced by editors/docs
Example fix
// before
new VertexAIApi({ keyJson: process.env.GCP_KEY_JSON });
// after
let creds;
try { creds = JSON.parse(process.env.GCP_KEY_JSON!); } catch (e) { throw new Error(`bad keyJson: ${e.message}`); }
new VertexAIApi({ keyJson: creds }); Defensive patterns
Strategy: validation
Validate before calling
try { const p = JSON.parse(keyJson); if (!p.client_email || !p.private_key) throw new Error('missing service-account fields'); } catch (e) { throw new Error(`keyJson invalid: ${(e as Error).message}`); } Try / catch
try { new VertexAIApi({ keyJson }); } catch (e) { if ((e as Error).message.includes('Failed to parse keyJson')) { /* re-parse yourself to surface the real cause */ } throw e; } Prevention
- Store secrets unmodified; compare hashes after round-tripping through env/secret managers
- Prefer keyFile paths over inlined JSON in env vars
- Never build key JSON by string concatenation
When it happens
Trigger: config.keyJson is not parseable JSON (trailing comma, smart quotes from copy/paste, BOM, truncated env var) or auth.fromJSON throws because required service-account fields (client_email, private_key, project_id) are missing or empty.
Common situations: Key pasted into a .env file where newlines break the value; key JSON stored in a secret manager that mangles quotes; key truncated by terminal copy; env var containing the literal string 'undefined'.
Related errors
- Failed to load credentials for Vertex AI: ${e.message}
- URL is not defined in params
- No workspace directories found. Make sure you've opened a fo
- VertexAI in express mode (apiKey only) cannot be configured
- region and projectId are required for VertexAI (when not usi
AI-assisted analysis of continuedev/continue@5522c6f44c (2026-08-27).
Data as JSON: /api/errors/0cb439a8e346a7d1.
Report an issue: GitHub.