GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — LM Studio a local 7B model issue "Cannot truncate prompt with n_keep (15028) >= n_ctx (7424)" · Issue #11141 · anomalyco/opencode

LM Studio a local 7B model issue "Cannot truncate prompt with n_keep (15028) >= n_ctx (7424)" #11141

New issue
Copy link
New issue
Copy link
Closed as not planned
Closed as not planned
LM Studio a local 7B model issue "Cannot truncate prompt with n_keep (15028) >= n_ctx (7424)"#11141
Copy link
Assignees
rekram1-node

Description

@abdulqadar
abdulqadar
opened on Jan 29, 2026
Issue body actions

When I try to ask something to local LM studio LLM it gives below error.

Did some R&D to find where to adjust this but could not find the right place for this config.

"Cannot truncate prompt with n_keep (15028) >= n_ctx (7424)"

Image
Reacted by Nikolaj Fabricius-Bjerre, Miguel González-López, Jose Luis Alonzo Velazquez, Maximiliano Arias and Wilson Silva

Activity

  1. github-actions
    assigned
    rekram1-node
    on Jan 29, 2026
  2. github-actions commented on Jan 29, 2026

    @github-actions
    github-actionsBot
    on Jan 29, 2026 – with GitHub Actions
    Contributor
    More actions

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

    • OpenCode v1.0.25 Hangs Indefinitely with LM Studio + Qwen Models Due to Empty tool_calls Array #4255: OpenCode v1.0.25 Hangs Indefinitely with LM Studio + Qwen Models Due to Empty tool_calls Array
    • Function call auto-truncation #8012: Function call auto-truncation (related to context window/prompt truncation)
    • Poor performance with local models #4385: Poor performance with local models
    • Only return tool_call parameters but can not run the tool with local LLM #7486: Only return tool_call parameters but can not run the tool with local LLM
    • LM Studio Failure to refresh models #2047: LM Studio Failure to refresh models

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

    Reacted by abdulqadar and kuze6969
  3. mgonzalezlopezudc commented on Feb 13, 2026

    @mgonzalezlopezudc
    mgonzalezlopezudc
    on Feb 13, 2026
    More actions

    Same behavior here with Qwen 0.6B running on LMstudio. However, setting in LMstudio the context for the model up to maximum, fixes the issue

    Reacted by Thomas Roche, Penar Musaraj, Vasanth Muralidharan, Emmanuel LOUISY-GABRIEL and OneShell
  4. KevinGimbel commented on Feb 16, 2026

    @KevinGimbel
    KevinGimbel
    on Feb 16, 2026
    More actions

    Same with openai/gpt-oss-20b, setting context to max fixed it.

  5. Jamescd1980 commented on Feb 28, 2026

    @Jamescd1980
    Jamescd1980
    on Feb 28, 2026
    More actions

    Increasing context size does not resolve the issue. It delays it. Eventually you have too many token to run anything. I'm having the same problem but I can't find away to adjust N_keep, so it will dump the tokens.

  6. max-arias commented on Mar 3, 2026

    @max-arias
    max-arias
    on Mar 3, 2026
    More actions

    Same issue with qwen/qwen3.5-9b running through LM Studio 0.4.6, Opencode 1.2.15

    Reacted by CaRLymx, Pavel Zamyatin, ixtdfox, ridwanadhip, jericirenej, Chunkai (CK), Michael K, Wilson Silva, Amr Arnous, OneShell and 2 more
  7. elecNation commented on Mar 4, 2026

    @elecNation
    elecNation
    on Mar 4, 2026
    More actions

    通过LM Studio 0.4.6,OpenClaw 运行的qwen/qwen3.5-9b 有同样的问题

    Reacted by Wilson Silva, OneShell, Hsin-You Yeh and suerb
  8. wilsonsilva commented on Mar 8, 2026

    @wilsonsilva
    wilsonsilva
    on Mar 8, 2026
    More actions

    I'm getting a similar error Cannot truncate prompt with n_keep (11378) >= n_ctx (4096)" with qwen/qwen3.5-9b and opencode 1.2.21.

    Edit: Seems like this isn't an issue with OpenCode itself, but with the configuration in LM Studio. I fixed this by setting the context length to the maximum the model supports (256k)

    Image
    Reacted by Luis Taniça and suerb
    Reacted by iKlsR, Luis Taniça and suerb
  9. Jamroszczyk commented on Mar 9, 2026

    @Jamroszczyk
    Jamroszczyk
    on Mar 9, 2026
    More actions
    1. Increase the context length in Model Defaults
    2. Reload the model into memory; only then will it be applied.

    Consider your available memory, however, before setting it to max. Some models explode with the max value.

    Reacted by Praise Dare
  10. Jamescd1980 commented on Mar 9, 2026

    @Jamescd1980
    Jamescd1980
    on Mar 9, 2026
    More actions

    As I said before. Increasing the context window only delays the inevitable issue Wilson and I are having. Increasing context window and setting it to rolling window only works when using the LM UI. When using LM as a server and a deferent program as the UI, like Open Interpreter. You will get the n_keep error. Reloading the model, relaunching LM, rebooting the pc, deleting and reinstalling LM Studio. None of them work to resolve the issue. It as files all over the place that you have to track down and delete in order to fix it. But that has to be done every time you get the n_keep error. The highest context window I can run is 128k. That is about 3.5-4 hours of work.

    Reacted by Wilson Silva
  11. codinoob1 commented on Mar 12, 2026

    @codinoob1
    codinoob1
    on Mar 12, 2026
    More actions

    While working with LLAMA 7B in Android Studio, I encountered persistent errors that prevented successful execution. I attempted to adjust various settings, but none of the changes resolved the issue.
    The errors consistently appeared during prompt execution, regardless of configuration changes. Unfortunately, I am currently unable to reproduce the issue, but I want to document it here for visibility and potential troubleshooting.
    Steps Taken

    • Adjusted Android Studio project settings (memory allocation, Gradle configs, etc.)
    • Attempted to lower the prompt size
    • Increased the context length
    • Reloaded the environment and retried execution
      Observed Behavior
    • Errors persisted despite configuration adjustments
    • No successful run achieved with LLAMA 7B in Android Studio
      Expected Behavior
    • Model should execute without persistent errors when prompt size and context length are within supported limits
      Notes
    • Issue occurred specifically with LLAMA 7B model
    • May be related to context length handling or prompt size constraints
    • Currently not reproducible, but documenting for future reference and community input
  12. github-actions commented on May 12, 2026

    @github-actions
    github-actionsBot
    on May 12, 2026 – with GitHub Actions
    Contributor
    More actions

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

  13. github-actions
    closed this as not plannedon May 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @rekram1-node
    rekram1-node

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.