Write/Update tool crashes Ink renderer on markdown files with very long single lines (~1000+ chars)

Resolved 💬 3 comments Opened Apr 26, 2026 by mezhibovskiy Closed Apr 28, 2026

Summary

Calling the Write or Update tool on a markdown file that contains a single line ≥ ~1000 chars (e.g., a long blockquote with embedded code fences, no soft-wrapping) crashes the Ink rendering pipeline. The agent becomes unresponsive; the terminal pane is flooded with the bundled cli.js source bytes; the agent cannot recover.

Reproduced in two independent agents at the same Update/Write call against the same file. Stack trace identical both times.

Environment

  • Claude Code (orchestrator + spawned general-purpose subagents)
  • macOS 25.4.0 (Darwin), zsh, tmux backend
  • Bundled CLI binary at /$bunfs/root/src/entrypoints/cli.js
  • Permission mode: bypassPermissions (parent), default for spawned agents
  • Both crashes happened in spawned general-purpose subagents on the same Team

Repro

  1. Create a markdown file repro.md with a single line ≥ ~1000 chars. Example payload (one line, no wrapping):
> **Closed: PENDING_TOKEN** (rationale: `customer.exists` value-layer mismatch resolved by adding `normalizePayerExtractedConfig` in `packages/core-domain/src/classification/llm/schemas/semantic-config-v2-payer.ts` and wiring it into `parsePayerConfigsAsResult` BEFORE `SemanticConfigV2PayerSchema.safeParse`. The normalizer rewrites every `customer.exists` field-path leaf to `buyer.is_authenticated` and coerces the value to a real boolean (`"false"` → `false`, `"true"` → `true`, `null`/`undefined` → `false` for guest semantics, boolean preserved). Integration regression at `packages/core-domain/src/classification/v2/payer/value-layer-normalization.test.ts` exercises the full V2 routing path. Adopts the deferred-doc Option C resolution path.)
  1. Ask Claude Code to either:
  • Write the file (target ≥1000-char line on line 1 or 3), OR
  • Update the file to remove that line.
  1. Both calls trigger the crash.

Tested both Write (initial author) and Update (later remove-line) — both fail at the same step.

Symptom

The pane stops responding. The terminal scrollback is flooded with raw cli.js source bytes (megabytes of minified JS — Ink-internal bundles for Box, Text, screen rendering, semver, etc.). The agent does not return a result. Stack-trace tail visible at the bottom of the dump:

- createInstance (/$bunfs/root/src/entrypoints/cli.js:502:249)
- PL (/$bunfs/root/src/entrypoints/cli.js:484:58456)
- LYH (/$bunfs/root/src/entrypoints/cli.js:484:88642)
- rZH (/$bunfs/root/src/entrypoints/cli.js:484:87842)
- RD6 (/$bunfs/root/src/entrypoints/cli.js:484:86738)
- iZH (/$bunfs/root/src/entrypoints/cli.js:484:86558)
- jM_ (/$bunfs/root/src/entrypoints/cli.js:484:83272)
- aH (/$bunfs/root/src/entrypoints/cli.js:484:6552)
- LH (/$bunfs/root/src/entrypoints/cli.js:484:5006)
- FH (/$bunfs/root/src/entrypoints/cli.js:484:5318)

The createInstancePLLYH chain points at React/Ink reconciler invocations during the tool-result rendering pass — likely the renderer choking on a layout calculation for a single token wider than the pane's text-wrap budget.

Expected behavior

Tool result rendering should soft-wrap or truncate long lines instead of crashing the renderer. The file write itself succeeded on disk (verified — the Write action persisted before the renderer collapsed); only the result-rendering layer dies.

Workaround

Wrap long markdown lines (≤200 chars) before invoking Write or Update. The tool succeeds normally on shorter lines.

Impact

In an agentic workflow that legitimately needs to edit long-line markdown (e.g., closure-marker headers carrying inline rationale, or auto-generated docs), the agent terminates mid-task and cannot self-recover. A fresh agent spawned against the same file path crashes at the same step. Required manual orchestrator intervention to complete the task.

Suggested fix area

cli.js:484 (rendering chain PL/LYH) — likely the Ink Text or Box width-calculation path. Either soft-wrap the rendered tool-result preview or hard-truncate at a character budget before passing to the layout engine. The underlying file system call (Write/Update) is correct; the rendering layer is the failure surface.

Severity

High — agent becomes non-functional and crashes the harness pane. Reproducible on demand. No in-tool workaround (the agent has no way to detect line length before issuing Write).

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗