continuedev/continue · error · Error
Failed to parse config.json: ${e}
Error message
Failed to parse config.json: ${e} What it means
Vertex AI express mode (API key auth) only supports Gemini endpoints; the adapter detects this combination during non-streaming chat and rejects it before making a request. Anthropic-on-Vertex and Mistral-on-Vertex require service-account OAuth.
Source
Thrown at core/config/load.ts:124
return a.name === b.name && a.params?.url === b.params?.url;
},
slashCommands: (a: any, b: any) => a.name === b.name,
customCommands: (a: any, b: any) => a.name === b.name,
};
function loadSerializedConfig(
workspaceConfigs: ContinueRcJson[],
ideSettings: IdeSettings,
ideType: IdeType,
overrideConfigJson: SerializedContinueConfig | undefined,
ide: IDE,
): ConfigResult<SerializedContinueConfig> {
let config: SerializedContinueConfig = overrideConfigJson!;
if (!config) {
try {
config = resolveSerializedConfig(getConfigJsonPath());
} catch (e) {
throw new Error(`Failed to parse config.json: ${e}`);
}
}
const errors = validateConfig(config);
if (errors?.some((error) => error.fatal)) {
return {
errors,
config: undefined,
configLoadInterrupted: true,
};
}
if (config.allowAnonymousTelemetry === undefined) {
config.allowAnonymousTelemetry = true;
}
if (ideSettings.remoteConfigServerUrl) {View on GitHub (pinned to 5522c6f44c)
Solutions
- Switch to service-account auth: remove apiKey and set keyJson/keyFile (or ADC) for non-gemini models
- Or keep a gemini-* model when using express apiKey mode
- Configure separate adapter instances per auth mode if you need both
Example fix
// before
new VertexAIApi({ apiKey: process.env.VERTEX_API_KEY, ... });
await api.chatCompletionNonStream({ model: 'claude-3-5-sonnet@...', ... }, signal);
// after
new VertexAIApi({ keyJson: SA_JSON, ... });
await api.chatCompletionNonStream({ model: 'claude-3-5-sonnet@...', ... }, signal); Defensive patterns
Strategy: validation
Validate before calling
const expressOk = (model: string, hasApiKey: boolean) => !hasApiKey || /gemini/i.test(model);
Type guard
const isGeminiModel = (m: string): boolean => /gemini/i.test(m);
Try / catch
try { ... } catch (e) { if ((e as Error).message.includes('express (apiKey) mode')) { /* switch to service-account auth or a gemini model */ } throw e; } Prevention
- Map auth mode to model family up front in config
- Keep two adapter instances: one express/gemini, one OAuth/anthropic-mistral
When it happens
Trigger: config.apiKey is set AND body.model resolves to a non-gemini provider (claude-* or mistral model) in chatCompletionNonStream.
Common situations: Developer reuses an OpenAI-style API key config then switches the model to claude-3-5-sonnet or codestral; or assumes the Vertex API key authenticates all publisher models.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- MCP Connection ${serverId} not found
- URL is not defined in params
- Response body is null
- Profile ${profileId} not found
- No workspace directories found. Make sure you've opened a fo
AI-assisted analysis of continuedev/continue@5522c6f44c (2026-08-27).
Data as JSON: /api/errors/fd8531b9ad777663.
Report an issue: GitHub.