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

  1. Validate keyJson parses before constructing: JSON.parse it yourself and log the real error
  2. Check the secret round-trips intact (compare length/hash against the original file)
  3. Store the key as a file and pass keyFile instead of keyJson
  4. 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

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


AI-assisted analysis of continuedev/continue@5522c6f44c (2026-08-27). Data as JSON: /api/errors/0cb439a8e346a7d1. Report an issue: GitHub.