Skip to content

Model context limits not respected #11286

Closed

Description

@gcp

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

Activity

  1. added
    bugSomething isn't working
    on Jan 30, 2026
  2. github-actions commented on Jan 30, 2026

    @github-actions
    Contributor

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

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

  3. github-actions commented on Apr 1, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.

  4. Milor123 commented on Jun 17, 2026

    @Milor123

    @gcp what is the solucion?

  5. gcp commented on Jun 17, 2026

    @gcp
    Author

    I have no idea, probably "don't use opencode".

  6. Milor123 commented on Jun 17, 2026

    @Milor123

    I have no idea, probably "don't use opencode".

    Ohh no, I found the solution for llama.cpp

    The parameter parallel divides the context into the normal, I've changed from -np 4 to -np 1 and it was solved for me using llama.cpp✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions