Skip to content

Every error message embeds the full tools JSON (Tool Debug Payload), 500k+ chars even with debug off #18

Description

@willowite

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:

  1. include Tool Debug Payload only when debug is enabled (the log file is a better home for it);
  2. 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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions