[Workflow + Write] Model silently truncates output mid-generation with ultracode active — 3 empty responses + script cut at token limit with no error

Resolved 💬 1 comment Opened Jun 3, 2026 by daveCode-dot Closed Jun 3, 2026

Summary

When ultracode is active and the user asks to run a Workflow, Claude Code produced 3 consecutive empty responses (zero text, zero tool calls, no error message) before eventually failing visibly. When the model finally attempted to invoke the Workflow tool, the inline script parameter was silently truncated mid-string at the output token limit, producing a JS parse error. A subsequent Write tool call with the same long content was also truncated at the same generation point — and the tool accepted the incomplete file without complaint.

Steps to reproduce

  1. Start a session with ultracode active (model: Opus 4.8).
  2. Ask Claude to generate a large Workflow script inline (e.g. a multi-lane audit workflow with a large CTX string ~3000 chars).
  3. Observe:
  • Attempts 1–3: Model generates a completely empty response (no text, no tool call). No error, no feedback to the user.
  • Attempt 4: Model invokes Workflow({script: "..."}) but the script param is truncated mid-string literal. Tool returns: Invalid workflow script: Script parse error: Unterminated string constant (11:13)
  • Attempt 5 (Write workaround): Model uses Write to save the script to a file. Content is truncated at the exact same generation point (1760 bytes instead of ~8000). Write tool accepts the incomplete content without error.

Evidence

File written by Write tool ends abruptly mid-string:

"...FissapClase" adivinable). _unique_name numera n

File size: 1760 bytes (expected ~8000 bytes). No error raised by Write tool.

Workflow error from inline script attempt:

Invalid workflow script: Script parse error: Unterminated string constant (11:13).
Workflow scripts must be plain JavaScript

Expected behavior

  1. Empty responses: When the model cannot generate a response (token limit, context issue), it should emit at minimum a brief error message rather than silent empty output. The user cannot tell if Claude processed their request or not.
  1. Workflow inline script: If the script parameter content would exceed what the model can generate in one output, the tool should either:
  • Reject with a clear message: "Script too long for inline generation — use scriptPath instead"
  • Or the model should detect it is approaching the output limit and self-truncate gracefully with a warning
  1. Write tool: Should not silently accept truncated content when the model hits its output token limit mid-generation. At minimum the harness should detect that generation stopped abnormally and surface an error.

Workaround

Use scriptPath instead of inline script param: write the script to disk first (in a separate, shorter generation), then pass {scriptPath: "/path/to/script.js"} to Workflow. This splits the generation across multiple turns and avoids the single-output token limit.

Environment

  • Model: Claude Opus 4.8
  • Mode: ultracode (Workflow tool invocation mandated)
  • Platform: Claude Code CLI (Mac, darwin 25.5.0)
  • Date: 2026-06-03

Impact

  • User experience: 3 silent empty responses caused the user to repeat the same message 3 times, believing their input was not received. This is deeply confusing and erodes trust.
  • Data integrity: Write tool accepting truncated JS files without error could cause hard-to-debug issues downstream (the file appears written successfully but contains invalid/incomplete code).

---
Reported automatically via Claude Code CLI on behalf of user.

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗