Skip to content

Agent gets stuck in endless loop of "Model call failed" #343

@rolfwr

Description

@rolfwr

Describe the bug

Unexpected failure loop shown in terminal output:

✓ write_bash
   ↪ 200 lines...

 ● Great! Now let's test if our new tool works:

 ✓ $ cd /home/rolfwr/mimir/alt && npx env-cmd esr server/tools/src/cmds/download-dynamodb-stream.ts /tmp/dynamodb-stream-test --max-hours=2 2>&1 | head -50
   ↪ 10 lines...

 ● The table exists but doesn't have a stream enabled according to the describe
   response. Let me check the actual table structure:

 ✗ $ cd /home/rolfwr/mimir/alt && npx env-cmd aws dynamodb describe-table --table-name mb10-mimir-prod-genericTable 2>&1 | grep -i stream | head -10
   Operation aborted by user

 > A point of clarification. The table we care about, which has streams enabled is "mb10-mimir-prod-item".

 ✗ Model call failed: {"message":"messages.192: `tool_use` ids were found without `tool_result` blocks immediately after: toolu_01UvmZN5EkHfndM9X2qekRsA. Each `tool_use` block must have a 
   corresponding `tool_result` block in the next message.","code":"invalid_request_body"} (Request ID: 85D4:239294:154F760:195108A:68F23588)

 ✗ Model call failed: {"message":"messages.192: `tool_use` ids were found without `tool_result` blocks immediately after: toolu_01UvmZN5EkHfndM9X2qekRsA. Each `tool_use` block must have a 
   corresponding `tool_result` block in the next message.","code":"invalid_request_body"} (Request ID: 85D4:239294:1550F49:1952BF3:68F2358A)

 ✗ Model call failed: {"message":"messages.192: `tool_use` ids were found without `tool_result` blocks immediately after: toolu_01UvmZN5EkHfndM9X2qekRsA. Each `tool_use` block must have a 
   corresponding `tool_result` block in the next message.","code":"invalid_request_body"} (Request ID: 85D4:239294:15529EB:1954AF1:68F23591)

 ✗ Model call failed: {"message":"messages.192: `tool_use` ids were found without `tool_result` blocks immediately after: toolu_01UvmZN5EkHfndM9X2qekRsA. Each `tool_use` block must have a 
   corresponding `tool_result` block in the next message.","code":"invalid_request_body"} (Request ID: 85D4:239294:15544FC:1956AB8:68F2359A)

 ✗ Model call failed: {"message":"messages.192: `tool_use` ids were found without `tool_result` blocks immediately after: toolu_01UvmZN5EkHfndM9X2qekRsA. Each `tool_use` block must have a 
   corresponding `tool_result` block in the next message.","code":"invalid_request_body"} (Request ID: 85D4:239294:1556D5E:19598B7:68F235A2)

 ✗ Model call failed: {"message":"messages.192: `tool_use` ids were found without `tool_result` blocks immediately after: toolu_01UvmZN5EkHfndM9X2qekRsA. Each `tool_use` block must have a 
   corresponding `tool_result` block in the next message.","code":"invalid_request_body"} (Request ID: 85D4:239294:155C27F:195FB5D:68F235AD)

 > You seem to have gotten stuck.

 ✗ Model call failed: {"message":"messages.192: `tool_use` ids were found without `tool_result` blocks immediately after: toolu_01UvmZN5EkHfndM9X2qekRsA. Each `tool_use` block must have a 
   corresponding `tool_result` block in the next message.","code":"invalid_request_body"} (Request ID: 985E:107A64:12E48E5:162D645:68F23643)

 ✗ Model call failed: {"message":"messages.192: `tool_use` ids were found without `tool_result` blocks immediately after: toolu_01UvmZN5EkHfndM9X2qekRsA. Each `tool_use` block must have a 
   corresponding `tool_result` block in the next message.","code":"invalid_request_body"} (Request ID: 985E:107A64:12E5D57:162EE4A:68F23644)

Problem persists after exiting out of copilot and re-running copilot with --continue option.

Affected version

0.0.343 Commit: 5847051

Steps to reproduce the behavior

Reproducing it using "copilot --continue" would require a way of exporting whatever persistent state that "--continue" operates on.

Expected behavior

Copilot does not go into endless loop of reporting ✗ Model call failed: {"message":"messages.192: tool_useids were found withouttool_resultblocks immediately after: toolu_01UvmZN5EkHfndM9X2qekRsA. Eachtool_useblock must have a correspondingtool_result block in the next message.","code":"invalid_request_body"} (Request ID: 847A:20242C:13286FE:1670E7E:68F2366E)

Or if it gets into this state, there is a way to reset it and get it back on track.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions