OpenCode

"Response still truncated after two output token limit continuations"

The error

Error: Response still truncated after two output token limit continuations

OpenCode's own error (type output-limit). Kilo Code, which is built on OpenCode, shows "The model hit its output limit while reasoning and produced no actionable output. Try disabling reasoning or increasing the output limit." for the reasoning case.

The model's reply was cut off by its output-token limit three times in a row. OpenCode asks the model to continue automatically after a cut-off, twice; when the third reply also ends at the limit, it stops with this error instead of looping. Retrying won't help. Raise the model's output limit (limit.output in opencode.json and the server's own limit for Ollama or LM Studio), turn reasoning down, or split the task into smaller pieces.

Why it happens

When a reply hits the model's output ceiling, the provider returns finish_reason "length". OpenCode treats that as unfinished, sends a hidden message telling the model it hit the limit and to break the remaining work into smaller pieces, and tries again. It gives up when the last three assistant messages all ended on "length".

  1. A low output limit on the model. Local servers are the usual culprit: an Ollama model with a small num_predict, an LM Studio preset with a low max-tokens value, or a custom model entry in opencode.json with a small limit.output.
  2. A reasoning model spending the budget on thinking. Thinking tokens count against the same output limit, so the visible answer gets what's left. This is exactly what Kilo Code's "hit its output limit while reasoning" message means.
  3. One huge tool call. Writing a 1,500-line file in a single write call needs one reply bigger than most output limits. OpenCode then tells the model the tool call wasn't executed because the output limit was reached before the arguments were complete.
  4. The context window is nearly full, so the server caps output to whatever room is left.

The fix

  1. 1 Raise the output limit for the model: set limit.output (and limit.context) for it in opencode.json or opencode.jsonc.
  2. 2 Make the server allow it too: on Ollama start with a larger context (OLLAMA_CONTEXT_LENGTH=65536 ollama serve) and raise num_predict in a Modelfile; on LM Studio raise context length and max tokens in the model's load settings; on a hosted provider check the model's documented maximum output.
  3. 3 Turn reasoning off or down for this task, for example with a lower reasoning-effort variant of the model.
  4. 4 Split the job: ask for the file skeleton first, then fill sections in separate turns.
  5. 5 Free up context: run /compact or start a new session if the conversation is long.
OLLAMA_CONTEXT_LENGTH=65536 ollama serve

Raise the limit in opencode.json

Set limit.output on the model you're using, and limit.context while you're there so compaction triggers at the right point. Current OpenCode (v2) uses a providers map; v1 configs used provider, which still loads. For Ollama, OpenCode finds a local server on its own; you only add the model entry to set its limits.

{
  "$schema": "https://opencode.ai/config.json",
  "providers": {
    "ollama": {
      "models": {
        "qwen3.8:27b": {
          "limit": { "context": 65536, "output": 16384 }
        }
      }
    }
  }
}

The server has its own ceiling and the lower one wins. On Ollama, also set PARAMETER num_predict 16384 in the Modelfile and check ollama ps for the loaded context; on LM Studio, check the model's max tokens.

How to confirm it's fixed

Re-run the same prompt. If the reply completes, or OpenCode now continues once and finishes, the limit is right. If it still stops after two continuations, the server-side limit (Ollama num_predict, LM Studio max tokens) is still below limit.output.

Other wordings of the same problem

"The model hit its output limit, so this response may be incomplete." is Kilo Code's warning for a single cut-off, before any continuation. Same fixes.

"The model hit its output limit while reasoning and produced no actionable output. Try disabling reasoning or increasing the output limit." is Kilo Code's reasoning case: turn reasoning down or raise the limit.

"Output exceeded the available model context and was truncated" and "Reply truncated at the model's output token limit" come from other clients; the cause and the fixes above are the same.

"[System: Your previous response was truncated by the output length limit. Continue exactly where you left off…]" is Hermes Agent's hidden continuation message leaking into the chat, and "response truncated due to output length limit" and "response remained truncated after N continuation attempts" are Hermes errors. On current Hermes the fix is the model server's output limit; Hermes no longer reads HERMES_MAX_TOKENS.

"Prompt is too long" in Claude Code is the opposite problem: input, not output.

Rather not tune limits by hand?

BetterClaw sets context and output limits per model for you, so an agent writing a long report doesn't stall halfway, and the free plan needs no card.

Full guideEvery truncation cause and fix: Hermes, Pi and OpenCode

Hit a different error?

Paste any agent error and get the cause and fix in seconds.

Open the decoder

Frequently asked questions

What does "response still truncated after two output token limit continuations" mean in OpenCode?

The model's reply hit its output-token limit three times in a row. OpenCode continues automatically twice after a cut-off; when the third attempt is also cut, it stops with this error rather than looping. Raise the model's output limit (limit.output in opencode.json, plus the server's own limit for Ollama or LM Studio), turn reasoning down, or split the task.

Why does it say "two" continuations when I saw three cut-offs?

The first cut-off is the original reply; the two continuations are the automatic retries after it. Three consecutive replies ending in finish_reason length trigger the error.

Does "the model hit its output limit while reasoning and produced no actionable output" have the same fix?

Yes. That's Kilo Code's wording for a reply where thinking tokens used up the whole output budget. Disable or reduce reasoning for the task, or raise the output limit so there's room for the answer after the thinking.

I raised limit.output in opencode.json and nothing changed. Why?

The server has its own ceiling and the lower one wins. On Ollama check num_predict and the loaded context (ollama ps); on LM Studio check the model's max tokens in its load settings. For hosted providers the model's documented maximum output applies regardless of your config.

Stop firefighting agent errors

Decoding errors one at a time is the manual version of what BetterClaw automates. Run your agents on a no-code AI agent platform with managed models, retries and config validation built in.

Free plan available · Pro $49/mo · BYOK · 7-day free trial