gemini-cli - 💡(How to fix) Fix ✕ [API Error: [{ "error": { "code": 400, "message": "Please ensure that the number of function response parts is equal to the number of function call parts of the function call turn.", "errors": [ { "message": "Please ensure that the number of function res [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
google-gemini/gemini-cli#25359Fetched 2026-04-15 06:45:25
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Timeline (top)
labeled ×3commented ×1

Error Message

[✕] [API Error: [{ "error": { "code": 400, "message": "Please ensure that the number of function response parts is equal to the number of function call parts of the function call turn.", "errors": [ { "message": "Please ensure that the number of function response parts is equal to the number of function call parts of the function call turn.", "domain": "global", "reason": "badRequest" } ], "status": "INVALID_ARGUMENT" } } ]] "text": "git push --set-upstream origin main\nEnumerating objects: 1003, done.\nCounting objects: 100% (1003/1003), done.\nDelta compression using up to 16 threads\nCompressing objects: 100% (930/930), done.\nerror: RPC failed; HTTP 408 curl 22 The requested URL returned error: 408\nsend-pack: unexpected disconnect while reading sideband packet\nWriting objects: 100% (1003/1003), 755.63 MiB | 11.44 MiB/s, done.\nTotal 1003 (delta 78), reused 0 (delta 0), pack-reused 0\nfatal: the remote end hung up unexpectedly\nEverything up-to-date"

Root Cause

[ACTION REQUIRED] 📎 PLEASE ATTACH THE EXPORTED CHAT HISTORY JSON FILE TO THIS ISSUE IF YOU FEEL COMFORTABLE SHARING IT.[ { "role": "user", "parts": [ { "text": "<SESSION_CONTEXT_REDACTED>" } ] }, { "role": "user", "parts": [ { "text": "<STATE_SNAPSHOT_REDACTED>" } ] }, { "role": "model", "parts": [ { "text": "Updated ignore rules to exclude large binaries and temporary directories. The push issue appears to be caused by a missing upstream branch and a large git pack size." } ] }, { "role": "user", "parts": [ { "text": "can you assist with the push as im getting errors" } ] }, { "role": "user", "parts": [ { "functionResponse": { "id": "run_shell_command_1", "name": "run_shell_command", "response": { "output": "Output: On branch main\nChanges to be committed:\n modified: .gitignore\n modified: package-lock.json\n new file: <REDACTED>\n new file: <REDACTED>\norigin https://github.com/<REDACTED>/<REDACTED>.git (fetch)\norigin https://github.com/<REDACTED>/<REDACTED>.git (push)" } } } ] }, { "role": "user", "parts": [ { "functionResponse": { "id": "run_shell_command_2", "name": "run_shell_command", "response": { "output": "Output: fatal: The current branch main has no upstream branch.\nTo push the current branch and set the remote as upstream, use\n\n git push --set-upstream origin main" } } } ] }, { "role": "user", "parts": [ { "text": "git push --set-upstream origin main\nEnumerating objects: 1003, done.\nCounting objects: 100% (1003/1003), done.\nDelta compression using up to 16 threads\nCompressing objects: 100% (930/930), done.\nerror: RPC failed; HTTP 408 curl 22 The requested URL returned error: 408\nsend-pack: unexpected disconnect while reading sideband packet\nWriting objects: 100% (1003/1003), 755.63 MiB | 11.44 MiB/s, done.\nTotal 1003 (delta 78), reused 0 (delta 0), pack-reused 0\nfatal: the remote end hung up unexpectedly\nEverything up-to-date" } ] }, { "role": "user", "parts": [ { "text": "OK, we've got Copilot trying to fix that. What can we do about the text to speech and speech to text system because they appear to be very slow." } ] } ]

RAW_BUFFERClick to expand / collapse

What happened?

[✕] [API Error: [{ "error": { "code": 400, "message": "Please ensure that the number of function response parts is equal to the number of function call parts of the function call turn.", "errors": [ { "message": "Please ensure that the number of function response parts is equal to the number of function call parts of the function call turn.", "domain": "global", "reason": "badRequest" } ], "status": "INVALID_ARGUMENT" } } ]]

[ACTION REQUIRED] 📎 PLEASE ATTACH THE EXPORTED CHAT HISTORY JSON FILE TO THIS ISSUE IF YOU FEEL COMFORTABLE SHARING IT.[ { "role": "user", "parts": [ { "text": "<SESSION_CONTEXT_REDACTED>" } ] }, { "role": "user", "parts": [ { "text": "<STATE_SNAPSHOT_REDACTED>" } ] }, { "role": "model", "parts": [ { "text": "Updated ignore rules to exclude large binaries and temporary directories. The push issue appears to be caused by a missing upstream branch and a large git pack size." } ] }, { "role": "user", "parts": [ { "text": "can you assist with the push as im getting errors" } ] }, { "role": "user", "parts": [ { "functionResponse": { "id": "run_shell_command_1", "name": "run_shell_command", "response": { "output": "Output: On branch main\nChanges to be committed:\n modified: .gitignore\n modified: package-lock.json\n new file: <REDACTED>\n new file: <REDACTED>\norigin https://github.com/<REDACTED>/<REDACTED>.git (fetch)\norigin https://github.com/<REDACTED>/<REDACTED>.git (push)" } } } ] }, { "role": "user", "parts": [ { "functionResponse": { "id": "run_shell_command_2", "name": "run_shell_command", "response": { "output": "Output: fatal: The current branch main has no upstream branch.\nTo push the current branch and set the remote as upstream, use\n\n git push --set-upstream origin main" } } } ] }, { "role": "user", "parts": [ { "text": "git push --set-upstream origin main\nEnumerating objects: 1003, done.\nCounting objects: 100% (1003/1003), done.\nDelta compression using up to 16 threads\nCompressing objects: 100% (930/930), done.\nerror: RPC failed; HTTP 408 curl 22 The requested URL returned error: 408\nsend-pack: unexpected disconnect while reading sideband packet\nWriting objects: 100% (1003/1003), 755.63 MiB | 11.44 MiB/s, done.\nTotal 1003 (delta 78), reused 0 (delta 0), pack-reused 0\nfatal: the remote end hung up unexpectedly\nEverything up-to-date" } ] }, { "role": "user", "parts": [ { "text": "OK, we've got Copilot trying to fix that. What can we do about the text to speech and speech to text system because they appear to be very slow." } ] } ]

What did you expect to happen?

Commit to work or at least my session. Not to die, and to be provided with a reason, as to what happened or at least a how to fix some sort of feedback

Client information

  • CLI Version: 0.37.2
  • Git Commit: 545e956c3
  • Session ID: be906bac-b8c8-4a41-a12a-3d3a3d08db3e
  • Operating System: win32 v23.11.0
  • Sandbox Environment: no sandbox
  • Model Version: auto-gemini-3
  • Auth Type: oauth-personal
  • Memory Usage: 613.0 MB
  • Terminal Name: Unknown
  • Terminal Background: #300a24
  • Kitty Keyboard Protocol: Unsupported

Login information

No response

Anything else we need to know?

No response

extent analysis

TL;DR

The API error 400 with a "badRequest" reason suggests that the number of function response parts does not match the number of function call parts, which may be causing the push issue.

Guidance

  • Verify the function call and response parts in the chat history JSON file to ensure they match in number.
  • Check the functionResponse sections in the chat history for any missing or mismatched responses.
  • Review the Git commands and outputs in the chat history to identify any potential issues with the push operation.
  • Consider checking the Git repository settings and branch configurations to ensure they are correctly set up for pushing.

Example

No specific code snippet can be provided without more context, but reviewing the chat history JSON file for matching function call and response parts is a good starting point.

Notes

The issue seems to be related to a mismatch between function call and response parts, but the root cause may be more complex and require further investigation. The provided chat history and client information may not be sufficient to fully resolve the issue.

Recommendation

Apply workaround: Review and adjust the function call and response parts in the chat history to ensure they match, and then retry the push operation. This may help resolve the immediate issue, but further investigation may be needed to prevent similar errors in the future.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING