Agent `Write` errors with missing `path`/`contents` after large stream or disconnect

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

In Agent mode, the Write tool sometimes fails with an error equivalent to:

Error: Invalid arguments — path: Required, contents: Required

even when the model clearly intended to pass both fields (the user can see a long file body in the assistant stream, then the tool result is this error).

Observed pattern (heuristic, not guaranteed):

  1. The assistant emits a Write call with a very large contents (e.g. a new markdown document on the order of hundreds of lines in one call), or
  2. The UI shows a Network Error / connection issue to the model provider and the user hits Resume, or
  3. The same turn is heavy (many file reads + a large write + large terminal output — see renderer / memory pressure discussions elsewhere).

In the same session, a tiny Write (a few lines) to a throwaway path often succeeds, which suggests the editor tool stack is healthy and the failure is intermittent / transport- or size-related, not simply “the model forgot the parameters.”

Symptom in one line: intermittent path / contents Required on Write, sometimes after large streamed tool arguments or after network blips — easy to misread as a model mistake when the underlying cause is a truncated server stream (see Additional Information → DevTools evidence).

Request: Please treat this as a robustness issue: ensure tool calls are atomically delivered to the executor, or surface a distinct error (“incomplete tool payload / stream truncated”) instead of the same Required message used for genuinely malformed calls. If there is a hard max payload size, document it and have the client chunk or reject before dispatch with a clear message.

Steps to Reproduce

  1. Open a repo in Cursor Agent mode.
  2. Ask the agent to create a new file with substantial content in one Write (e.g. a 200+ line reference doc), or work until a Network Error appears mid-turn, then Resume and observe the next tool results.
  3. Watch the tool call panel / transcript for Write failing with missing path or contents despite visible intent in the stream.

(Reliability may vary by model, network, and turn size — this is an intermittent class.)

Expected Behavior

  • A Write either fully applies with both path
    and contents, or fails with a specific error (e.g. payload too large, stream incomplete, retry guidance) — not the same validation error as a call that never included parameters.
  • Optionally: client-side chunking or guidance to split large creations so users are not stuck in a retry loop.

Screenshots / Screen Recordings

Four captures from the 2026-05-10 repro session (Cursor 3.4.1, Claude Opus 4.7, Agent mode). Arranged from the transport edge (what the user sees) inward to the same-payload retry success (what proves the failure is intermittent, not a model parameter omission).

  1. Agent chat view of the empty-args failure — repeated Edit attempted / Invalid arguments / path: Required / contents: Required rows after the stall, with the agent itself stating “The earlier failures were empty Write calls — the path and contents weren’t sent.” and “Something’s stripping the arguments from my test.” The error message is the same one a genuinely malformed call would surface, even though the model intent in the assistant stream included both fields.

    ![Cursor chat showing repeated Edit attempted / Invalid arguments / path Required / contents Required errors with the agent narrating empty Write calls]

  1. Network Error toast at the model-provider edge“We’re having trouble connecting to the model provider. This might be temporary — please try again in a moment.” with Copy Request (01902d22-75b2-4e2f-9dce-c1c91617d578) and a Resume button. This is the user-visible state during the No first token within 2 / 4 / 6 / 8 / 10 s stall logged in DevTools.

    ![Network Error toast: “We’re having trouble connecting to the model provider…”, Copy Request 01902d22-75b2-4e2f-9dce-c1c91617d578, Resume]

  1. The empty-args symptom hits a short probe Write tootest-write-probe.md (+1 / −1, content probe) followed by Delete test-write-probe.md, with another Invalid arguments / path: Required / contents: Required in between, and the agent reasoning “write calls getting truncated on longer files, so I’ll try submitting the principles document body as a single fresh tool call instead.” Useful evidence that the failure is transport-level, not strictly a hard payload-size cliff: the same session can fail an empty-args probe and then succeed on the next attempt with the same shape.

    ![Probe write of test-write-probe.md alongside another Invalid arguments error and a Delete, with the agent diagnosing truncated Write calls]

  1. Same large Write payload — failure then success, seconds apart — the user prompt “Continue writing the principle file as one big chunk. I will try to find the error in Developer Tools”, the agent’s first single-shot Write returning Invalid arguments (no path / contents reaching the executor), and the second identical attempt landing as problem-solving-principles.md +217. Identical model intent, two outcomes, one DevTools [resource_exhausted] (request id 27d56df6-f54f-4276-aff0-57388b0add4d) between them.

    ![Same large Write payload: first attempt fails Invalid arguments, second attempt writes problem-solving-principles.md +217 lines successfully]

Operating System

Windows 10/11

Version Information

Field Value
Cursor 3.4.1 (Stable, quality: stable, target: user)
VS Code base 1.105.1 (vscodeVersion in product.json)
Commit 2a298dd06944a9b9ea541d28225b779fcbcc6200
Build date 2026-05-08T16:05:07.818Z

For AI issues: which model did you use?

Claude Opus 4.7 (Cursor Agent — long-form / high-reasoning tier; slug family claude-opus-4-7-thinking-xhigh when explicitly selected). The failure class was observed during large single-turn file authoring; exact model string may differ if Auto switches mid-session.

For AI issues: add Request ID with privacy disabled

01902d22-75b2-4e2f-9dce-c1c91617d578 — copied from the Network Error dialog’s Copy Request control in the same session window where subsequent tool dispatch showed the empty-args pattern (2026-05-10, UTC+3). Staff: please confirm whether this ID correlates with truncated or partially applied tool calls after reconnect / Resume.

Additional Information

Workspace context (this report): Local Windows folder workspace — not Remote-SSH, not Remote-WSL as the primary root. Repo root path does not contain a standalone dot-first directory segment in the sense of forum #155260 (that class is explicitly ruled out for this repro narrative).

Staff triage context (sibling “Invalid arguments” family): In reply #4 on #155260, Cursor staff describe a known family of bugs where StrReplace / Write fail with “Invalid arguments” while Read still works, with triggers that have included multi-root workspaces, Remote-SSH, and a dot-prefixed directory in the workspace path. They ask reporters to capture Help → Toggle Developer Tools → Console output when the error fires (especially UriError or path-related lines) and note workarounds for the path-shape cases. Related-topic links on that thread also surface #154093 and #153001 (SSH / editing / URI), alongside #151252, #148706, and #154841. Many of those environment-specific reports may already be addressed or narrowed in newer stable builds; this report is filed on Cursor 3.4.1 (2026-05-08) and concerns large streamed Write / Network Error + Resume with path / contents Required at the tool layer — please say whether that still fits the same family or should be tracked separately from URI/path routing.

Electron / runtime (from HelpAbout on same build, if shown): typically Electron 39.x / Chromium 142.x / Node 22.x — paste your About copy if staff needs bit-for-bit parity.

DevTools evidence captured 2026-05-10 17:33–17:44 (Cursor 3.4.1, Claude Opus 4.7, Agent mode, single-shot Write ~16 KB / ~250-line markdown — empty-args repro):

The repro window in the captured Console log shows four correlated signals around the failed turn (next turn with the same payload shape succeeded):

  1. Stream stall preceding the empty-args result. The composer logs five escalating warnings:
    • [composer] No first token received within 2s
    • … within 4s / 6s / 8s / 10s (workbench.desktop.main.js:42033 / :29892).
      The user-visible Network Error dialog corresponds to this stall.
  2. Server-side stream termination — gRPC/Connect RESOURCE_EXHAUSTED. Immediately after the stall:
    • [transport] Stream error reported from extension host ConnectError: [resource_exhausted] Error
    • [transport] Stream ended without turnEnded — connection likely dropped mid-stream; caught non-retriable stream error, rethrowing as-is
    • [transport] [AGENT_ERROR_DIAGNOSTICS] requestId=27d56df6-f54f-4276-aff0-57388b0add4d originalRequestId=27d56df6-f54f-4276-aff0-57388b0add4d decision=RETRY (countAsServerError=true, countAsTransportError=false)
      [resource_exhausted] is gRPC code 8 — typically message size exceeded or quota / rate-limit. The stream did not carry a turnEnded frame, so the partial assistant response (including the Write tool-call argument block) was truncated before it reached the client-side dispatcher.
  3. Adjacent HTTP/2 transport instability on co-resident services. The same window contains repeated [transport] Connect error in unary AI connect ConnectError: [internal] Stream closed with error code NGHTTP2_REFUSED_STREAM from aiserver.v1.BackgroundComposerService.ListTeamEnvironments and getGithubAccessTokenForRepos. Those calls are not the failing Write itself, but they show that the HTTP/2 connection multiplex was being hit with REFUSED_STREAM (server-side concurrency rejection) at the same moment. Earlier in the session the OS suspended network I/O (net::ERR_NETWORK_IO_SUSPENDED from api3.cursor.sh/tev1/v1/rgstr), consistent with a sleep / wake boundary preceding the stall.
  4. No UriError and no path-related Console lines. The signal staff asked about on #155260/4 (UriError / path parsing) is absent in this capture — supporting the claim that this report is a separate variant from the dot-path / SSH / multi-root family, in the stream / payload class.

HAR note: the accompanying vscode-app.har was started after the failure window so it does not contain the 27d56df6-… request body; no 4xx/5xx entries were captured. The Console log above carries the diagnostic signal.

Hypothesis (one line): an oversized model-stream response (large Write.contents) tripped a server-side RESOURCE_EXHAUSTED mid-stream; the client correctly classified it as decision=RETRY (countAsServerError=true) but the partial tool-call surfaced to the executor as path / contents Required instead of a payload-size / retry-this-shorter error.

Related forum reports (most relevant — environment family + mechanism overlap):

User / agent workaround (outside product): split large new files into a short initial Write plus smaller follow-up edits so each tool payload stays bounded.

Does this stop you from using Cursor

Sometimes - I can sometimes use Cursor

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.