Summary
On every non-OK response the plugin appends Tool Debug Payload: ${toolDebugPayload} to the error message, and toolDebugPayload is always JSON.stringify(requestPayload.tools). It is not gated by debug or OPENCODE_ANTIGRAVITY_DEBUG. With a realistic tool set the error message becomes hundreds of kilobytes.
Numbers
With ~200 tools (built-ins plus MCP servers):
- a 400 error message was 513,039 characters
- even a plain 429
Resource has been exhausted (e.g. check quota). came back as 166,404 characters
Debug flags were off (OPENCODE_ANTIGRAVITY_DEBUG unset, no debug in config).
Why it hurts
The error message is what OpenCode and other plugins show and store. Orchestrators that report failed attempts to a parent session paste it verbatim: one background-task summary with three failed Gemini attempts was 1.75 MB, and a chain of retry notifications reached 6.2M characters and overflowed a 1M-token context window of the parent model.
Where
packages/opencode/src/plugin/request.ts on main:
- L2070
toolDebugPayload = JSON.stringify(requestPayload.tools) — unconditional
- L2666 the
[Debug Info] block appends Tool Debug Payload: ${toolDebugPayload}
Suggested fix
Any of these would solve it:
- include
Tool Debug Payload only when debug is enabled (the log file is a better home for it);
- otherwise truncate it, e.g.
String(toolDebugPayload).slice(0, 2000), or replace it with a summary (tool count and names).
Locally I truncate it to 2000 characters on 2.2.1; the [Debug Info] header lines stay useful and the message size drops to a few KB.
Environment
@cortexkit/opencode-antigravity-auth 2.2.1 (latest on npm)
- OpenCode 1.18.31, Windows 11
Summary
On every non-OK response the plugin appends
Tool Debug Payload: ${toolDebugPayload}to the error message, andtoolDebugPayloadis alwaysJSON.stringify(requestPayload.tools). It is not gated bydebugorOPENCODE_ANTIGRAVITY_DEBUG. With a realistic tool set the error message becomes hundreds of kilobytes.Numbers
With ~200 tools (built-ins plus MCP servers):
Resource has been exhausted (e.g. check quota).came back as 166,404 charactersDebug flags were off (
OPENCODE_ANTIGRAVITY_DEBUGunset, nodebugin config).Why it hurts
The error message is what OpenCode and other plugins show and store. Orchestrators that report failed attempts to a parent session paste it verbatim: one background-task summary with three failed Gemini attempts was 1.75 MB, and a chain of retry notifications reached 6.2M characters and overflowed a 1M-token context window of the parent model.
Where
packages/opencode/src/plugin/request.tsonmain:toolDebugPayload = JSON.stringify(requestPayload.tools)— unconditional[Debug Info]block appendsTool Debug Payload: ${toolDebugPayload}Suggested fix
Any of these would solve it:
Tool Debug Payloadonly when debug is enabled (the log file is a better home for it);String(toolDebugPayload).slice(0, 2000), or replace it with a summary (tool count and names).Locally I truncate it to 2000 characters on 2.2.1; the
[Debug Info]header lines stay useful and the message size drops to a few KB.Environment
@cortexkit/opencode-antigravity-auth2.2.1 (latest on npm)