Skip to content

Context usage is corrupted (exceeded max tokens) #2496

@huevosyitz

Description

@huevosyitz

Describe the bug

i’m using github copilot CLI, I was noticing that github copilot was frequently compacting our conversation even just barely talking to it, it would always compact for like every 5-10 seconds. then i checked context via /context command. an di see an empty context usage but the token usage is 156% (exceeding 100%) probably explains it was trying to compact every time.

Image

i switched to VS code’s chat UI but i don’t see the context indicator but i still encounter frequent compaction. seems it occurrs for both.

i also see this error every time (got from Chat Debug)

Error Details
Type: query Message: Execution failed: CAPIError: 400 messages.0.content.1: unexpected tool_use_id found in tool_result blocks: toolu_vrtx_01BSkxKg1NgdPqD5BS9rzow1. Each tool_result block must have a corresponding tool_use block in the previous message. (Request ID: 3B15:1772B0:15DD9F:1A80BC:69CF2C14)

Stack
CAPIError: 400 messages.0.content.1: unexpected tool_use_id found in tool_result blocks: toolu_vrtx_01BSkxKg1NgdPqD5BS9rzow1. Each tool_result block must have a corresponding tool_use block in the previous message. at t.fromAPIError (file:///Users/yitz/.vscode/extensions/github.copilot-chat-0.42.3/node_modules/@github/copilot/sdk/index.js:2007:948) at n5e.getCompletionWithTools (file:///Users/yitz/.vscode/extensions/github.copilot-chat-0.42.3/node_modules/@github/copilot/sdk/index.js:2007:10940) at processTicksAndRejections (node:internal/process/task_queues:103:5) at Lme.getCompletionWithTools (file:///Users/yitz/.vscode/extensions/github.copilot-chat-0.42.3/node_modules/@github/copilot/sdk/index.js:2019:2332) at t.runAgenticLoop (file:///Users/yitz/.vscode/extensions/github.copilot-chat-0.42.3/node_modules/@github/copilot/sdk/index.js:2798:37675) at t.processQueuedItems (file:///Users/yitz/.vscode/extensions/github.copilot-chat-0.42.3/node_modules/@github/copilot/sdk/index.js:2798:5762) at t.processQueue (file:///Users/yitz/.vscode/extensions/github.copilot-chat-0.42.3/node_modules/@github/copilot/sdk/index.js:2798:897) at t.send (file:///Users/yitz/.vscode/extensions/github.copilot-chat-0.42.3/node_modules/@github/copilot/sdk/index.js:2796:4035) at iae.sendRequestInternal (/Users/yitz/.vscode/extensions/github.copilot-chat-0.42.3/dist/extension.js:2255:1423) at iae._handleRequestImplInner (/Users/yitz/.vscode/extensions/github.copilot-chat-0.42.3/dist/extension.js:2253:880) at /Users/yitz/.vscode/extensions/github.copilot-chat-0.42.3/dist/extension.js:2250:3216 at /Users/yitz/.vscode/extensions/github.copilot-chat-0.42.3/dist/extension.js:5950:2555

and then copilot crashes and stops.

Affected version

GitHub Copilot CLI 1.0.17

Steps to reproduce the behavior

not sure how i replicated this but i recently just ran /update and i notice i’m seeing this error. just started seeing this error today (April 3)

Expected behavior

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions