STUPID-2026-0076

Cline's tool-call JSON repair silently executed truncated write_file and terminal arguments as valid

6.0medium
August 6, 2026Source checkedRepro reported

Why 6/10

Truncated tool arguments could be written or executed silently for any Cline user. Reported with a repro, fixed within a week, no victim reported.

Scope
3/4
A whole machine or drive, an organisation's production system or data, or many credentials
Recoverability
2/3
Partly lost, or loss reported without saying whether it was recovered
Did it happen
1/2
Demonstrated (proof of concept, reproduction, controlled test or near-miss) with no real victim reported
Beyond the user
0/1
Only the user's own non-production work

The score is the sum of these four factors. How each factor is scored · scored 2026-10-29

  1. Instruction given

    None specific to this bug — the defect lives in Cline's tool-call streaming pipeline itself and can trigger during any task where the model's tool-call arguments get cut off mid-value, most commonly by hitting a max_tokens limit while still writing a long string argument (file contents, a terminal command, a commit message).

  2. Expected behavior

    When a streamed tool call's arguments are truncated mid-value, Cline should surface the truncation as a recoverable error so the model can retry with the full argument, rather than treating the incomplete data as a successfully parsed tool call and executing it.

  3. Actual behavior

    Cline's experimental_repairToolCall path falls back to the jsonrepair library when standard JSON parsing of a streamed tool call fails. jsonrepair closes unterminated strings as-is instead of rejecting them, so a tool call cut off mid-argument comes out as syntactically valid but semantically corrupted JSON — and Cline executed it without any warning that truncation had occurred. Because the affected code path is generic (ai-sdk.ts's registration of experimental_repairToolCall, and json.ts's use of jsonrepair), it applies to any tool accepting a free-form string argument, including write_file (file contents) and terminal/shell command execution. The reporter's minimal repro fed a truncated write_file call — `{"path":"config/database.yml","content":"production:\n host: db.prod.internal\n password: correct-horse-battery-sta` — into the parsing path and got back a valid-looking object with the cut-off password string, no error raised.

  4. Damage

    No named production incident was reported alongside this issue — it was filed as a code-level defect with a reproduction, not a user recounting data loss. The risk it describes is real regardless: any write_file or terminal argument truncated mid-string by a max_tokens limit would be silently written or executed with corrupted content (e.g. a cut-off password or config value landing on disk, or a partial shell command running) with no diagnostic signal to the model or the user. Cline's maintainers treated the report as credible — it was assigned to a maintainer and fixed in PR #13015, merged six days later on 2026-08-12, which adds truncation detection that rejects unterminated strings instead of repairing them.

Full write-up

A Cline user (canblmz1) reported that the agent's tool-call error-recovery path could turn a truncated tool call into one that executes anyway, with corrupted arguments and no warning. When a model's streamed tool-call arguments get cut off mid-value — commonly by hitting a max_tokens limit while still writing a string — Cline's experimental_repairToolCall step falls back to the jsonrepair library to salvage a parse. jsonrepair closes unterminated strings rather than rejecting them, so the truncated call comes out looking like a normal, successfully parsed tool call instead of a failed one. Because the affected code sits in Cline's generic tool-call parsing layer, it isn't limited to one tool: any tool taking a free-form string argument is exposed, including write_file (file contents) and terminal/shell command execution. The reporter's minimal reproduction fed a truncated write_file call — a YAML config with a password cut off mid-string — through the parsing path and got back a valid-looking object containing the incomplete password, with no error raised anywhere in the chain. Cline's maintainers treated the report as credible: it was assigned, and a fix shipped as PR #13015 six days later, adding detection for unterminated strings so truncated arguments are now rejected and surfaced as a recoverable error instead of executed silently.

Classification

Agent
Cline
Failure mode
Logic Error
Root cause
Other
Domain
Infra
OWASP Agentic Top 10 (our mapping)
ASI02 Tool Misuse and Exploitation list
MIT AI Risk Repository (our mapping)
7.3 Lack of capability or robustness taxonomy

Related incidents

Cite this record
StupidLLM. "STUPID-2026-0076: Cline's tool-call JSON repair silently executed truncated write_file and terminal arguments as valid." AI Agent Incident Database, 2026. https://www.stupidllm.com/incident/STUPID-2026-0076/ (accessed 2026-11-12). CC BY 4.0.

← STUPID-2026-0075By IDSTUPID-2026-0077 →

Get told when an agent breaks something

We document AI agent failures daily, severity-scored against a published scale. Each Monday, if any scored 7 or above that week — deleted data, leaked secrets, broken production — you get one email with the sources. When nothing did, you get nothing.

This database is callable over MCP — query it from inside your agent.