When it breaks

It gets most of the way through, then just stops mid-sentence

Also asked as Claude stops during long coding tasks · the answer was cut off · it stopped writing halfway · the file it generated is incomplete

Cause documented by a vendor or a published paper Not tested by benchr First logged Last checked

What is actually happening

The response hit the maximum output length. The model did not decide it was finished; the response was ended for it.

Why

  • Maximum output tokens is a separate ceiling from the context window, and it is usually much smaller. A million-token input does not buy a million-token answer.
  • A single request that has to emit a whole file, a whole chapter or a whole test suite is the shape most likely to hit it.
  • The stop reason is reported by the API, so this is detectable rather than mysterious — but a chat interface may not surface it.

The quick fix

Ask for one section, not the whole thing, and then ask for the next. Two short answers beat one truncated one.

The real fix

Give the work a structure it can resume: an outline first, then one unit per turn, with the model writing each unit to a file rather than into the reply. Long-running agent setups exist precisely so the work survives a single response ending.

Step by step

  1. Check the stop reason if you are on the API — truncation and completion are different signals.
  2. Ask for a plan or a file list first, then request items one at a time.
  3. Raise the output limit if the interface exposes it, but treat that as buying room, not solving the shape.
  4. For code, have it write files instead of printing them, so the reply is a log rather than the artefact.
  5. For long documents, ask for section N and a one-line handover to section N+1.

Grounded in

Where this leads