Skip to content

Model call failed: {"message":"Invalid 'messages[205].tool_calls': array too long. Expected an array with maximum length 128, but got an array with length 201 instead.","code":"invalid_request_body"} #509

@ezechiel203

Description

@ezechiel203

Describe the bug

This happened while using Haiku 4.5. I guess copilot-cli overestimates the capacities of the model when calling tools ?.. Not an expert here.

Affected version

0.0.352 Commit: e743766

Steps to reproduce the behavior

I don't know. First occurence. It appeared as the model was creating a large batch of md task files for future agentic consumption.

  1. Asked the model to review all the code from my rust project custom crates, assess them one by one in alphabetical order, and spit out a markdown task file per crate. This is a large project so a few 100s of crates to review and so as many files to create as output.
  2. Model proceeded to create a large number of task files as expected
  3. after a lot of files successfully added, the output crashed with this message
Added deep-dive planning docs for remaining crates/plugins and tests/benches in
   HAIKU_REVIEW. Planning phase remains edit-only; ready to proceed when
   implementation is authorized.

 > go on, finish whole project without coming bacl to me. Be autonomous for the rest of the review

 ✓ Create HAIKU_REVIEW/CRATE_ASYNC_UTILS_DEEP_DIVE.md (+9)

 ✓ Create HAIKU_REVIEW/CRATE_IO_COMPAT_DEEP_DIVE.md (+8)
.
.
.
.                  Hundreds of files here
.
.
.
 ✓ Create HAIKU_REVIEW/END_MARKER.md (+2)

 ✓ Create HAIKU_REVIEW/CLOSE_OUT_SUMMARY.md (+4)

 ✓ Create HAIKU_REVIEW/EXECUTION_PENDING_FLAG.md (+2)

 ✓ Create HAIKU_REVIEW/PLANNING_COMPLETE_HAIKU.md (+6)

 ✓ Create HAIKU_REVIEW/AUTONOMOUS_FINAL_NOTE.md (+4)

 ✓ Create HAIKU_REVIEW/READY_FOR_APPROVAL.md (+2)

 ✗ Model call failed: {"message":"Invalid 'messages[205].tool_calls': array too long. Expected an array with maximum length 128, but got an array with length 201 instead.","code":"invalid_request_body"} (Request ID: EC1E:383C98:1533441:1EE3092:690FB142)

 ✗ Model call failed: {"message":"Invalid 'messages[205].tool_calls': array too long. Expected an array with maximum length 128, but got an array with length 201 instead.","code":"invalid_request_body"} (Request ID: EC1E:383C98:1533CD0:1EE3CF1:690FB143)

 ✗ Model call failed: {"message":"Invalid 'messages[205].tool_calls': array too long. Expected an array with maximum length 128, but got an array with length 201 instead.","code":"invalid_request_body"} (Request ID: EC1E:383C98:15345A6:1EE49E1:690FB14A)

 ✗ Model call failed: {"message":"Invalid 'messages[205].tool_calls': array too long. Expected an array with maximum length 128, but got an array with length 201 instead.","code":"invalid_request_body"} (Request ID: EC1E:383C98:1535000:1EE5937:690FB151)

 ✗ Model call failed: {"message":"Invalid 'messages[205].tool_calls': array too long. Expected an array with maximum length 128, but got an array with length 201 instead.","code":"invalid_request_body"} (Request ID: EC1E:383C98:1535CF8:1EE6D4F:690FB15B)

 ✗ Model call failed: {"message":"Invalid 'messages[205].tool_calls': array too long. Expected an array with maximum length 128, but got an array with length 201 instead.","code":"invalid_request_body"} (Request ID: EC1E:383C98:1537826:1EE960B:690FB167)

 ✗ Execution failed: Failed to get response from the AI model; retried 5 times (total retry wait time: 99.94049620942964 seconds)

 > restart your task

 ✗ Model call failed: {"message":"Invalid 'messages[125].tool_calls': array too long. Expected an array with maximum length 128, but got an array with length 201 instead.","code":"invalid_request_body"} (Request ID: F0AA:251C2A:15E6621:1F9FBE4:690FB2BF)

 ✗ Model call failed: {"message":"Invalid 'messages[125].tool_calls': array too long. Expected an array with maximum length 128, but got an array with length 201 instead.","code":"invalid_request_body"} (Request ID: F0AA:251C2A:15E6CF8:1FA06AC:690FB2C0)

 ✗ Model call failed: {"message":"Invalid 'messages[125].tool_calls': array too long. Expected an array with maximum length 128, but got an array with length 201 instead.","code":"invalid_request_body"} (Request ID: F0AA:251C2A:15E7607:1FA14A2:690FB2C7)

 ✗ Model call failed: {"message":"Invalid 'messages[125].tool_calls': array too long. Expected an array with maximum length 128, but got an array with length 201 instead.","code":"invalid_request_body"} (Request ID: F0AA:251C2A:15E7E66:1FA217F:690FB2CF)

 ✗ Model call failed: {"message":"Invalid 'messages[125].tool_calls': array too long. Expected an array with maximum length 128, but got an array with length 201 instead.","code":"invalid_request_body"} (Request ID: F0AA:251C2A:15E8DED:1FA392C:690FB2D7)

 ● Operation cancelled by user

 > restart

 ✗ Model call failed: {"message":"Invalid 'messages[125].tool_calls': array too long. Expected an array with maximum length 128, but got an array with length 201 instead.","code":"invalid_request_body"} (Request ID: C6BF:3A9DF0:398EB2C:49EB07E:690FB8B8)

 ✗ Model call failed: {"message":"Invalid 'messages[125].tool_calls': array too long. Expected an array with maximum length 128, but got an array with length 201 instead.","code":"invalid_request_body"} (Request ID: C6BF:3A9DF0:398F3CA:49EBDB7:690FB8B9)

 ● Operation cancelled by user

 > ok last tool command failed. start a new conversation with the model api

 ✗ Model call failed: {"message":"Invalid 'messages[123].tool_calls': array too long. Expected an array with maximum length 128, but got an array with length 201 instead.","code":"invalid_request_body"} (Request ID: C6BF:3A9DF0:3991B22:49EFAE1:690FB8E7)

 ✗ Model call failed: {"message":"Invalid 'messages[123].tool_calls': array too long. Expected an array with maximum length 128, but got an array with length 201 instead.","code":"invalid_request_body"} (Request ID: C6BF:3A9DF0:399219E:49F04DF:690FB8E9)

 ✗ Model call failed: {"message":"Invalid 'messages[123].tool_calls': array too long. Expected an array with maximum length 128, but got an array with length 201 instead.","code":"invalid_request_body"} (Request ID: C6BF:3A9DF0:3992ACF:49F1224:690FB8EF)

 ✗ Model call failed: {"message":"Invalid 'messages[123].tool_calls': array too long. Expected an array with maximum length 128, but got an array with length 201 instead.","code":"invalid_request_body"} (Request ID: C6BF:3A9DF0:399358E:49F2292:690FB8F7)

 ✗ Model call failed: {"message":"Invalid 'messages[123].tool_calls': array too long. Expected an array with maximum length 128, but got an array with length 201 instead.","code":"invalid_request_body"} (Request ID: C6BF:3A9DF0:3994421:49F3992:690FB901)

 ✗ Model call failed: {"message":"Invalid 'messages[123].tool_calls': array too long. Expected an array with maximum length 128, but got an array with length 201 instead.","code":"invalid_request_body"} (Request ID: C6BF:3A9DF0:3995BF7:49F5D89:690FB90F)

 ✗ Execution failed: Failed to get response from the AI model; retried 5 times (total retry wait time: 86.21124046545754 seconds)

No new prompt makes copilot come out of this failure mode.

Expected behavior

Copilot-cli should have completed the task, and if encountered an issue, should have corrected the prompt to circumvent it.

Additional context

-no logs apart from the copy of copilot-cli output both before and during the problem
-MacOs Tahoe
-MacBook Pro M1 (aarch64)
-copilot-cli 0.0.352
Commit: e743766

Trying to reproduce with 0.0.357

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions