You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] Ollama model infinite loop with "ask_followup_question" #511
Extension version: 3.58.0
Provider: ollama (proxy)
Model: qwen3-coder-next:latest Roo tried to use ask_followup_question without value for required parameter 'follow_up'. Retrying... assist with code
Reproduction Steps:
Setup Ollama as provider
Choose Qwen model
Ask questio in any mode (architect, code, ask, etc.)
Infinite loop because it never completes the follow_up question
I'm not exactly sure what to file this as and it could simply be a bug in the way the model is trained vs. how Zoo-Code interacts with it. Just trying a new extension setup and running into an issue where the model never finishes because Zoo keeps attempting to make API requests, despite seemingly the model being done with its response and waiting on a next prompt from me.
Is this an issue with the integration model (Qwen) or that Zoo is expecting it to ask a question when it was simply done and waiting for the next prompt so it thought to ask a follow up question the model didn't intend to make?
If this is user error on my part (i.e. bad model setup) then I can close. I know there's a warning that says Zoo is expected to work with Claude models, so it's quite possibly an issue there.
I have the same problem with Version: 3.60.0 (a62a652c) on AWS Bedrock Opus 4.8. It often gets the ask_followup_question calls wrong and cannot manage to fix them.
But I managed to get a full reproducer! Screenshot of it:
You can reproduce it by running this prompt with the below file:
Read @/zoo-code-issue-ask_followup_question-nonarray-follow_up.md . Reproduce the issue in this chat.
ask_followup_question fails with misleading "Missing value for required parameter 'follow_up'" when follow_up is present but not a JSON array
Summary
When a native tool call for ask_followup_question arrives with a follow_up
argument that is present but is not a JSON array (e.g. a JSON object, string, or
number), the tool fails with:
Missing value for required parameter 'follow_up'. Please retry with complete response.
The error message is misleading: the value is not missing, it is the wrong
type. The finalize parse path accepts the non-array value, and the tool then
rejects it with a "missing" error, sending the model into a confusing retry loop
(the model believes it already supplied follow_up).
Steps to reproduce
Call ask_followup_question with a valid question and a follow_up that is a
JSON object instead of an array:
{
"question": "How should I handle the intensity_only guard removal?",
"follow_up": {
"0": { "mode": null, "text": "Keep the guard" },
"1": { "mode": null, "text": "Remove the guard" }
}
}
This deterministically reproduces the error every time.
For comparison:
A valid non-empty array follow_up works.
An empty array follow_up: [] does NOT produce this error; it passes the
array check but then hangs the UI with no buttons and no error (a likely
separate bug, noted below).
Only a non-array (object/string/number) value triggers the "Missing value"
error.
Expected behavior
A non-array follow_up should produce a clear, accurate error (e.g.
"follow_up must be an array of {text, mode?} items"), not "Missing value".
The finalize parse path should validate follow_up the same way the streaming
partial path does, so both paths agree.
Root cause
There are two parse paths in src/core/assistant-message/NativeToolCallParser.ts and they disagree on follow_up:
The streaming PARTIAL path (createPartialToolUse) guards with Array.isArray(...):
The non-array value then flows through BaseTool.handle (which executes using block.nativeArgs) into AskFollowupQuestionTool.execute, which rejects it:
if(!follow_up||!Array.isArray(follow_up)){awaitrecordMissingParamError("follow_up")// -> "Missing value for required parameter 'follow_up'"return}
Because recordMissingParamError always reports "Missing value", the type
mismatch is reported as a missing parameter.
Why this appears intermittently in practice
The bug is not limited to a model literally emitting an object. With native
streaming, the tool-call arguments are accumulated and parsed incrementally by partial-json. When follow_up items are serialized compactly (e.g.
text-first {"text":"...","mode":null}), the value bound to follow_up can
resolve to a non-array intermediate depending on where chunk boundaries fall.
Those boundaries shift with question length, punctuation, and follow_up
key order/whitespace. Since the finalize path does not enforce Array.isArray,
any such non-array value reaches execute and triggers the error. This is why
the failure flips between FAIL and WORKED with seemingly cosmetic changes to the
question or the follow_up serialization, while a clean single-blob array always
succeeds.
Suggested fix
Make the finalize path consistent with the partial path by requiring an array:
Activity
nh2 commentedon Jun 19, 2026
I have the same problem with
Version: 3.60.0 (a62a652c)on AWS Bedrock Opus 4.8. It often gets theask_followup_questioncalls wrong and cannot manage to fix them.But I managed to get a full reproducer! Screenshot of it:
You can reproduce it by running this prompt with the below file:
zoo-code-issue-ask_followup_question-nonarray-follow_up.md
I'll copy the contents of the file into the next comment so people can read/google it easily here.
I did the code analysis on commit 0306f2b.
nh2 commentedon Jun 19, 2026
ask_followup_questionfails with misleading "Missing value for required parameter 'follow_up'" whenfollow_upis present but not a JSON arraySummary
When a native tool call for
ask_followup_questionarrives with afollow_upargument that is present but is not a JSON array (e.g. a JSON object, string, or
number), the tool fails with:
The error message is misleading: the value is not missing, it is the wrong
type. The finalize parse path accepts the non-array value, and the tool then
rejects it with a "missing" error, sending the model into a confusing retry loop
(the model believes it already supplied
follow_up).Steps to reproduce
Call
ask_followup_questionwith a validquestionand afollow_upthat is aJSON object instead of an array:
{ "question": "How should I handle the intensity_only guard removal?", "follow_up": { "0": { "mode": null, "text": "Keep the guard" }, "1": { "mode": null, "text": "Remove the guard" } } }This deterministically reproduces the error every time.
For comparison:
follow_upworks.follow_up: []does NOT produce this error; it passes thearray check but then hangs the UI with no buttons and no error (a likely
separate bug, noted below).
error.
Expected behavior
follow_upshould produce a clear, accurate error (e.g."
follow_upmust be an array of{text, mode?}items"), not "Missing value".follow_upthe same way the streamingpartial path does, so both paths agree.
Root cause
There are two parse paths in
src/core/assistant-message/NativeToolCallParser.tsand they disagree onfollow_up:The streaming PARTIAL path (
createPartialToolUse) guards withArray.isArray(...):The FINALIZE path (
parseToolCall) does NOT; it only checks for!== undefinedand passes the raw value through:The non-array value then flows through
BaseTool.handle(which executes usingblock.nativeArgs) intoAskFollowupQuestionTool.execute, which rejects it:Because
recordMissingParamErroralways reports "Missing value", the typemismatch is reported as a missing parameter.
Why this appears intermittently in practice
The bug is not limited to a model literally emitting an object. With native
streaming, the tool-call arguments are accumulated and parsed incrementally by
partial-json. Whenfollow_upitems are serialized compactly (e.g.text-first
{"text":"...","mode":null}), the value bound tofollow_upcanresolve to a non-array intermediate depending on where chunk boundaries fall.
Those boundaries shift with question length, punctuation, and follow_up
key order/whitespace. Since the finalize path does not enforce
Array.isArray,any such non-array value reaches
executeand triggers the error. This is whythe failure flips between FAIL and WORKED with seemingly cosmetic changes to the
question or the follow_up serialization, while a clean single-blob array always
succeeds.
Suggested fix
Make the finalize path consistent with the partial path by requiring an array:
Additionally:
follow_upreports atype/shape error rather than "Missing value", so the model can correct it.
Affected files
src/core/assistant-message/NativeToolCallParser.ts(
parseToolCallvscreatePartialToolUse)src/core/tools/AskFollowupQuestionTool.ts(execute)src/core/tools/BaseTool.ts(handle, executes vianativeArgs)fix(ask_followup_question): report non-array follow_up as a type error.