copilot-cli icon indicating copy to clipboard operation
copilot-cli copied to clipboard

Fail Tool Calls

Open zzyu17 opened this issue 6 months ago • 3 comments

Describe the bug

When configuring Copilot to use DeepSeek-V4 models (either Flash or Pro), 400 error occurs:

✗ 400 {"error":{"message":"messages.108: `tool_use` ids were found without `tool_result` blocks immediately after: call_8ZMDT1DJ43gofat5AalrxCTn. Each `tool_use` block must have a corresponding `tool_result` block in the next 
  message.","type":"invalid_request_error","param":null,"code":"invalid_request_error"}} 

Affected version

1.0.44

Steps to reproduce the behavior

No response

Expected behavior

No response

Additional context

  • OS: WSL2 (Ubuntu 24.04)
  • Config:
  export COPILOT_PROVIDER_BASE_URL="https://api.deepseek.com/anthropic"
  export COPILOT_PROVIDER_TYPE="anthropic"
  export COPILOT_MODEL="deepseek-v4-flash"/"deepseek-v4-pro"
  export COPILOT_PROVIDER_MAX_PROMPT_TOKENS="1000000"
  export COPILOT_PROVIDER_MAX_OUTPUT_TOKENS="384000"

zzyu17 avatar May 09 '26 10:05 zzyu17

Also, is there a feature to downgrade/reinstall specific version of Copilot CLI? I have tried uninstall and reinstall via npm (npm install -g @github/[email protected]) and download script (curl -fsSL https://gh.io/copilot-install | VERSION="v1.0.42" bash) with specified version (1.0.42), but after reinstalling, Copilot CLI is still at 1.0.44.

zzyu17 avatar May 09 '26 10:05 zzyu17

I seem to find the possible cause and quick workaround: The fail tool call can be caused by conflicting simultaneous incoming message from user (e.g., when the same session is being resumed in several terminals and prompts come in at the same time). Removing the corresponding entries in .copilot/session-state/<session-id>/events.jsonl can help.

zzyu17 avatar May 11 '26 15:05 zzyu17

Thanks for the detailed report. Recent releases include several session-resume hardenings: interrupted tool calls are recovered more reliably, late or out-of-order tool results are normalized, and conversation history is validated before new model requests. These changes prevent malformed history from repeatedly failing and leaving a session unusable.

We’re closing this as resolved. If it recurs on the latest version, please open a new issue with the CLI version and reproduction details.

szabta89 avatar Jul 31 '26 10:07 szabta89