Model context limits not respected #8032

Open
opened 2026-02-16 18:08:58 -05:00 by yindo · 1 comment
Owner

Originally created by @gcp on GitHub (Jan 30, 2026).

Originally assigned to: @rekram1-node on GitHub.

Description

opencode.jsonc has:

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "llama.cpp": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Llama.cpp (local)",
      "options": {
        "baseURL": "http://127.0.0.1:8080/v1",
        "timeout": false
      },
      "models": {
         "minimax-m2.1-reap-30": {
          "name": "Minimax M2.1 REAP-30",
          "limit": {
            "context": 65536,
            "output": 16384
          }
        }
      }
    }
  }
}

Somewhere along the way, the model tries to read a file, but the file is rather large:

     → Read file.py

  ┃
  ┃  request (68879 tokens) exceeds the available context size (65536 tokens), try increasing it
  ┃

That error is from llama.cpp:

slot update_slots: id  3 | task 0 | new prompt, n_ctx_slot = 65536, n_keep = 0, task.n_tokens = 68885
srv    send_error: task id = 0, error: request (68885 tokens) exceeds the available context size (65536 tokens), try increasing it

Which means this is an opencode bug. It should report back that the file can't be read due to context limits.

Plugins

No response

OpenCode version

1.1.40

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

Ubuntu 24.04

Terminal

iTerm2

Originally created by @gcp on GitHub (Jan 30, 2026). Originally assigned to: @rekram1-node on GitHub. ### Description `opencode.jsonc` has: ``` { "$schema": "https://opencode.ai/config.json", "provider": { "llama.cpp": { "npm": "@ai-sdk/openai-compatible", "name": "Llama.cpp (local)", "options": { "baseURL": "http://127.0.0.1:8080/v1", "timeout": false }, "models": { "minimax-m2.1-reap-30": { "name": "Minimax M2.1 REAP-30", "limit": { "context": 65536, "output": 16384 } } } } } } ``` Somewhere along the way, the model tries to read a file, but the file is rather large: ``` → Read file.py ┃ ┃ request (68879 tokens) exceeds the available context size (65536 tokens), try increasing it ┃ ``` That error is from llama.cpp: ``` slot update_slots: id 3 | task 0 | new prompt, n_ctx_slot = 65536, n_keep = 0, task.n_tokens = 68885 srv send_error: task id = 0, error: request (68885 tokens) exceeds the available context size (65536 tokens), try increasing it ``` Which means this is an opencode bug. It should report back that the file can't be read due to context limits. ### Plugins _No response_ ### OpenCode version 1.1.40 ### Steps to reproduce _No response_ ### Screenshot and/or share link _No response_ ### Operating System Ubuntu 24.04 ### Terminal iTerm2
yindo added the bug label 2026-02-16 18:08:58 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Jan 30, 2026):

This issue might be a duplicate of existing issues. Please check:

  • #10220: Request size exceeds model context window (similar error when context limits are exceeded)
  • #10157: Opencode crashes attempting to read too big file (file reading not respecting context limits)
  • #10634: Compaction overflow check doesn't account for large tool outputs until the next step (context limits not being enforced)
  • #8089: Auto-compaction enabled by default, but context_length_exceeded errors still occur (requests exceeding context limits despite settings)
  • #10759: Auto-detect Ollama model context limits (context limits not properly detected/respected)

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Jan 30, 2026): This issue might be a duplicate of existing issues. Please check: - #10220: Request size exceeds model context window (similar error when context limits are exceeded) - #10157: Opencode crashes attempting to read too big file (file reading not respecting context limits) - #10634: Compaction overflow check doesn't account for large tool outputs until the next step (context limits not being enforced) - #8089: Auto-compaction enabled by default, but context_length_exceeded errors still occur (requests exceeding context limits despite settings) - #10759: Auto-detect Ollama model context limits (context limits not properly detected/respected) Feel free to ignore if none of these address your specific case.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#8032