Skip to content

Bug: Intermittent "Unexpected response format" error on Gemini models with inconsistent state logging #7241

@Keomars

Description

@Keomars

Before submitting your bug report

Relevant environment info

OS: macOS Sequoia Apple M4 15.4.1

VS Code Version: 1.103.1 (Universal)

Continue Extension Version: 1.0.23

Model: Gemini-2.5-pro

- config:
  
  provider: gemini
  model: gemini-2.5-pro

Description

Bug Description:
When using a Gemini model, the extension intermittently fails to parse and display a successful API response. This appears to be a client-side parsing issue, as the object logged in the Developer Tools console is a valid, successful response from the Gemini API.

Key Symptoms & Inconsistencies:

Intermittent Nature: The bug does not occur on every request. I have not been able to find a consistent pattern to reproduce it, but it happens with high frequency across different prompts.

UI vs. Payload Discrepancy: Even when selecting Agent or Plan mode in the UI, the "Continue Console" log consistently shows the request Type as Chat. However, inspecting the full Options object in the Continue Console reveals that the model's configuration (e.g., role, tools) does seem to change correctly according to the selected mode.

Conflicting Status Reports: When the error occurs, the main "Developer Tools" console logs the Unexpected response format error. Simultaneously, the "Continue Console" view logs the Result of the same request as Success.

These details strongly suggest potential bugs in the extension's frontend state management, API request construction, and/or response handling logic, specific to the Gemini provider.

Logs:

// From "Developer: Toggle Developer Tools"
[Extension Host] Unexpected response format: {candidates: Array(1), usageMetadata: {…}, modelVersion: 'gemini-2.5-pro', responseId: '...'}

Additional Context:
This issue appears to be separate from the Failed to load LanceDB problem reported in #7192.

To reproduce

  1. Configure Environment:

Use VS Code 1.103.1 on macOS with Apple Silicon.

Install the continue extension (v1.0.23).

Configure a Gemini model (e.g., gemini-2.5-pro) as the LLM provider.

  1. Perform Action:

Open the Continue side panel.

Select a mode Chat/Plan/Agent.

Send a prompt to the model (e.g., "hello").

  1. Observe Inconsistent Behavior:

Symptom 1 (Intermittent Error): The Developer: Toggle Developer Tools console intermittently shows an Unexpected response format error.

Symptom 2 (Incorrect Logged Type): The Continue Console output panel consistently logs the request Type as Chat, even though Agent or Plan was selected.

Symptom 3 (Conflicting Status): When the error occurs, the Developer Tools console shows the error, but the Continue Console logs the Result of the same request as Success with Generated Tokens: 0.

Log output

[Extension Host] Unexpected response format: {candidates: Array(1), usageMetadata: {…}, modelVersion: 'gemini-2.5-pro', responseId: '...'}

Metadata

Metadata

Assignees

Labels

area:chatRelates to chat interfaceide:vscodeRelates specifically to VS Code extensionkind:bugIndicates an unexpected problem or unintended behavioros:macHappening specifically on Mac

Type

No type

Projects

Status

Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions