Skip to content

Frequent "Error: unexpected API Response" Google GeminiΒ #6986

@robertwinkler-research

Description

@robertwinkler-research

Type: Bug

  1. Select Gemini 2.5 Pro through Gemini API
  2. Start using Roo Code/chat
  3. About every 2nd Gemini response is interrupted during thinking or in the first sentence of response and Error Unexpected API Response: The language model did not provide any assistant messages. This may indicate an issue with the API or the model's output. .

Looking at the exported task, this seems to be tool usage failures? Not 100% sure. I'm pasting it below.

Max Tokens are set to 51200, max Thinking Tokens 1024, the additional Gemini options (URL context, Search Grounding) are disabled. This happens with fresh context. I do not have third party system prompt modifiers. I ssh into a cluster, this happens on multiple local machines and with code as well as insiders.

This started recently (last week or two, though I wasn't too active). Let me know if you need more info and whether it is reproducible at all. I would usually chalk this up to Gemini temporary stupidity, but it has been going for days now and is very disruptive, so I was hoping for help.

Ah, I made a minimal memory bank rule:
.roo/rules/01-memory-bank-instructions.md
When starting a new task, the memory-bank must be read first, in order to learn the context necessary to work on the project.
These mandatory files are
memory-bank/project_context_and_decisions.md
memory-bank/project_current_architecture.md
memory-bank/project_status_and_patterns.md
Other files only need to be read upon explicit instruction.

Code mode may proceed reading only memory-bank/project_status_and_patterns.md, if full context is not needed for the task. Explicit user instruction supersedes these instructions.

Thanks for your work, and sorry if this is an issue with my config.

Extension version: 3.25.11
VS Code version: Code 1.103.0 (e3550cfac4b63ca4eafca7b601f0d2885817fd1f, 2025-08-06T21:40:10.271Z)
OS version: Windows_NT x64 10.0.26100
Modes:
Remote OS version: Linux x64 5.14.0-578.el9.x86_64

Task

I have to censor a lot here, sorry.

# VSCode Visible Files

VSCode Open Tabs

censor

Current Time

censor

Current Cost

$0.00

Current Mode

architect
πŸ—οΈ Architect
gemini-2.5-pro

Current Workspace Dire censor Files

(Workspace files context disabled. Use list_files to explore if needed.)
You have not created a todo list yet. Create one with update_todo_list if your task is complicated or involves multiple steps.
</environment_details>


Assistant:

I've reviewed your thoughts and will now sort through them to create a structured to-do list. This will help us organize the tasks and ensure we don't miss any details.

First, as per the project's rules, I need to get the necessary context by reading the memory bank. This will help me understand the project's architecture, patterns, and previous decisions, which is crucial for creating an accurate and relevant plan.

<read_file>


memory-bank/project_context_and_decisions.md


memory-bank/project_current_architecture.md


memory-bank/project_status_and_patterns.md


</read_file>


User:

[read_file for 'memory-bank/project_context_and_decisions.md', 'memory-bank/project_current_architecture.md', 'memory-bank/project_status_and_patterns.md'] Result:
The user denied this operation and provided the following feedback:

only project status and patterns


memory-bank/project_context_and_decisions.mdDenied by user
memory-bank/project_current_architecture.mdDenied by user
memory-bank/project_status_and_patterns.mdDenied by user

<environment_details>

VSCode Visible Files

VSCode Open Tabs

censor

Current Time

censor

Current Cost

$0.02

Current Mode

architect
πŸ—οΈ Architect
gemini-2.5-pro
You have not created a todo list yet. Create one with update_todo_list if your task is complicated or involves multiple steps.
</environment_details>


Assistant:

Failure: I did not provide a response.


User:

[ERROR] You did not use a tool in your previous response! Please retry with a tool use.

Reminder: Instructions for Tool Use

Tool uses are formatted using XML-style tags. The tool name itself becomes the XML tag name. Each parameter is enclosed within its own set of tags. Here's the structure:

<actual_tool_name>
<parameter1_name>value1</parameter1_name>
<parameter2_name>value2</parameter2_name>
...
</actual_tool_name>

For example, to use the attempt_completion tool:

<attempt_completion>

I have completed the task...

</attempt_completion>

Always use the actual tool name as the XML tag name for proper parsing and execution.

Next Steps

If you have completed the user's task, use the attempt_completion tool.
If you require additional information from the user, use the ask_followup_question tool.
Otherwise, if you have not completed the task and do not need additional information, then proceed with the next step of the task.
(This is an automated message, so do not respond to it conversationally.)
<environment_details>

VSCode Visible Files

VSCode Open Tabs

censor

Current Time

censor

Current Cost

$0.10

Current Mode

architect
πŸ—οΈ Architect
gemini-2.5-pro
You have not created a todo list yet. Create one with update_todo_list if your task is complicated or involves multiple steps.
</environment_details>

New instructions for task continuation:
<user_message>
Ah also make a subtask to (censor) as they are not documented yet and you need to understand them for this
</user_message>
<environment_details>

VSCode Visible Files

VSCode Open Tabs

censor

Current Time

censor

Current Cost

$0.10

Current Mode

orchestrator
πŸͺƒ Orchestrator
gemini-2.5-pro

Current Workspace Directory censor

(Workspace files context disabled. Use list_files to explore if needed.)
You have not created a todo list yet. Create one with update_todo_list if your task is complicated or involves multiple steps.
</environment_details>


Assistant:

Thank you for providing the detailed context. I have analyzed your requests and the project's status and patterns. I will now create a temporary to-do list in a markdown file that outlines the required tasks, arguments, and relevant documentation as you requested.

First, I will create the markdown file to house the to-do list.

<write_to_file>
results**/(censored)**/next_steps_todo.md

MO(have to censor sorry....)training script (to

[Response interrupted by a tool use result. Only one tool may be used at a time and should be placed at the end of the message.]


User:

[write_to_file for 'results**(censored)**/next_steps_todo.md'] Result:
The tool execution failed with the following error:

Tool "write_to_file" is not allowed in orchestrator mode.

<environment_details>

VSCode Visible Files

VSCode Open Tabs

censor

Current Time

censor

Current Cost

$0.10

Current Mode

orchestrator
πŸͺƒ Orchestrator
gemini-2.5-pro
You have not created a todo list yet. Create one with update_todo_list if your task is complicated or involves multiple steps.
</environment_details>


Assistant:

Failure: I did not provide a response.


User:

[ERROR] You did not use a tool in your previous response! Please retry with a tool use.

Reminder: Instructions for Tool Use

Tool uses are formatted using XML-style tags. The tool name itself becomes the XML tag name. Each parameter is enclosed within its own set of tags. Here's the structure:

<actual_tool_name>
<parameter1_name>value1</parameter1_name>
<parameter2_name>value2</parameter2_name>
...
</actual_tool_name>

For example, to use the attempt_completion tool:

<attempt_completion>

I have completed the task...

</attempt_completion>

Always use the actual tool name as the XML tag name for proper parsing and execution.

Next Steps

If you have completed the user's task, use the attempt_completion tool.
If you require additional information from the user, use the ask_followup_question tool.
Otherwise, if you have not completed the task and do not need additional information, then proceed with the next step of the task.
(This is an automated message, so do not respond to it conversationally.)
<environment_details>

VSCode Visible Files

VSCode Open Tabs

scripts/(censor)/visualize_results.R

Current Time

censored

Current Cost

$0.11

Current Mode

orchestrator
πŸͺƒ Orchestrator
gemini-2.5-pro
You have not created a todo list yet. Create one with update_todo_list if your task is complicated or involves multiple steps.
</environment_details>


Assistant:

Failure: I did not provide a response.

System Info
Item Value
CPUs AMD Ryzen 7 PRO 6850U with Radeon Graphics (16 x 2695)
GPU Status 2d_canvas: enabled
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
trees_in_viz: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) undefined
Memory (System) 30.76GB (7.71GB free)
Process Argv --crash-reporter-id 185a55ad-3945-4d53-a2b2-7311cd0331bb
Screen Reader no
VM 0%
Item Value
Remote SSH: 100.108.241.14
OS Linux x64 5.14.0-578.el9.x86_64
CPUs AMD EPYC 7763 64-Core Processor (256 x 2450)
Memory (System) 1007.17GB (801.80GB free)
VM 0%
A/B Experiments
vsliv368cf:30146710
vswsl492cf:30256860
binariesv615:30325510
nativeloc1:31344060
dwcopilot:31170013
6074i472:31201624
dwoutputs:31242946
copilot_t_ci:31333650
e5gg6876:31282496
pythoneinst12:31285622
c7cif404:31314491
996jf627:31283433
pythonrdcb7:31342333
usemplatestapi:31297334
0aa6g176:31307128
747dc170:31275177
aj953862:31281341
pylancequickfixt:31358882
9d2cg352:31346308
convertlamdat:31358880
usemarketplace:31343026
nesew2to5:31336538
agentclaude:31350858
4f60g487:31327383
replacestringexc:31350595
nes-set-on:31351930
6abeh943:31336334
yijiwantestdri0626-c:31336931
0927b901:31350571
f76d9909:31348711
45650338:31358607
0cj2b977:31352657
controlchatstate:31363048

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue/PR - TriageNew issue. Needs quick review to confirm validity and assign labels.bugSomething isn't working

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions