[GH-ISSUE #7545] ERROR source=runner.go:426 msg="failed to decode batch" error="could not find a KV slot for the batch - try reducing the size of the batch or increase the context. code: 1" #82480

Closed
opened 2026-05-09 14:18:15 -05:00 by GiteaMirror · 7 comments
Owner

Originally created by @wuhongsheng on GitHub (Nov 7, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/7545

What is the issue?

ERROR source=runner.go:426 msg="failed to decode batch" error="could not find a KV slot for the batch - try reducing the size of the batch or increase the context. code: 1"

OS

macOS

GPU

Apple

CPU

Apple

Ollama version

0.4

Originally created by @wuhongsheng on GitHub (Nov 7, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/7545 ### What is the issue? ERROR source=runner.go:426 msg="failed to decode batch" error="could not find a KV slot for the batch - try reducing the size of the batch or increase the context. code: 1" ### OS macOS ### GPU Apple ### CPU Apple ### Ollama version 0.4
GiteaMirror added the bugneeds more info labels 2026-05-09 14:18:15 -05:00
Author
Owner

@wuhongsheng commented on GitHub (Nov 7, 2024):

cheap_model_max_async=2,
best_model_max_async=2,

<!-- gh-comment-id:2461605202 --> @wuhongsheng commented on GitHub (Nov 7, 2024): cheap_model_max_async=2, best_model_max_async=2,
Author
Owner

@pengfan7758258 commented on GitHub (Nov 7, 2024):

The version is too new. I downgraded to version 0.3.14, and the issue was resolved. However, I noticed that in version 0.4, the GPU utilization decreased. Looking forward to a more stable release in future versions.

<!-- gh-comment-id:2461913295 --> @pengfan7758258 commented on GitHub (Nov 7, 2024): The version is too new. I downgraded to version 0.3.14, and the issue was resolved. However, I noticed that in version 0.4, the GPU utilization decreased. Looking forward to a more stable release in future versions.
Author
Owner

@jessegross commented on GitHub (Nov 7, 2024):

@wuhongsheng Can you please post the full server logs?

<!-- gh-comment-id:2462855934 --> @jessegross commented on GitHub (Nov 7, 2024): @wuhongsheng Can you please post the full [server logs](https://github.com/ollama/ollama/blob/main/docs/troubleshooting.md#how-to-troubleshoot-issues)?
Author
Owner

@jessegross commented on GitHub (Nov 14, 2024):

This may be fixed in main - if anyone who is experiencing this issue can build from source and test it, that would be helpful to confirm.

<!-- gh-comment-id:2475170375 --> @jessegross commented on GitHub (Nov 14, 2024): This may be fixed in `main` - if anyone who is experiencing this issue can build from source and test it, that would be helpful to confirm.
Author
Owner

@fce2 commented on GitHub (Nov 17, 2024):

just fyi, with ollama 0.4.2 i also get this error (using llama2-11b)

here is some log, loosk like the "limit" is not set correct (set to 2k, but llama2 has 128k)

time=2024-11-17T09:22:10.460+01:00 level=WARN source=runner.go:122 msg="input exceeds context length" prompt=54273 limit=2048
time=2024-11-17T09:22:10.635+01:00 level=ERROR source=runner.go:429 msg="failed to decode batch" error="could not find a KV slot for the batch - try reducing the size of the batch or increase the context. code: 1"
time=2024-11-17T09:22:10.809+01:00 level=ERROR source=runner.go:429 msg="failed to decode batch" error="could not find a KV slot for the batch - try reducing the size of the batch or increase the context. code: 1"
time=2024-11-17T09:22:10.810+01:00 level=ERROR source=runner.go:429 msg="failed to decode batch" error="could not find a KV slot for the batch - try reducing the size of the batch or increase the context. code: 1"
time=2024-11-17T09:22:10.949+01:00 level=ERROR source=runner.go:429 msg="failed to decode batch" error="could not find a KV slot for the batch - try reducing the size of the batch or increase the context. code: 1"
time=2024-11-17T09:22:11.167+01:00 level=ERROR source=runner.go:429 msg="failed to decode batch" error="could not find a KV slot for the batch - try reducing the size of the batch or increase the context. code: 1"
time=2024-11-17T09:22:11.370+01:00 level=ERROR source=runner.go:429 msg="failed to decode batch" error="could not find a KV slot for the batch - try reducing the size of the batch or increase the context. code: 1"
time=2024-11-17T09:22:11.590+01:00 level=ERROR source=runner.go:429 msg="failed to decode batch" error="could not find a KV slot for the batch - try reducing the size of the batch or increase the context. code: 1"
<!-- gh-comment-id:2481028111 --> @fce2 commented on GitHub (Nov 17, 2024): just fyi, with ollama 0.4.2 i also get this error (using llama2-11b) here is some log, loosk like the "limit" is not set correct (set to 2k, but llama2 has 128k) ``` time=2024-11-17T09:22:10.460+01:00 level=WARN source=runner.go:122 msg="input exceeds context length" prompt=54273 limit=2048 time=2024-11-17T09:22:10.635+01:00 level=ERROR source=runner.go:429 msg="failed to decode batch" error="could not find a KV slot for the batch - try reducing the size of the batch or increase the context. code: 1" time=2024-11-17T09:22:10.809+01:00 level=ERROR source=runner.go:429 msg="failed to decode batch" error="could not find a KV slot for the batch - try reducing the size of the batch or increase the context. code: 1" time=2024-11-17T09:22:10.810+01:00 level=ERROR source=runner.go:429 msg="failed to decode batch" error="could not find a KV slot for the batch - try reducing the size of the batch or increase the context. code: 1" time=2024-11-17T09:22:10.949+01:00 level=ERROR source=runner.go:429 msg="failed to decode batch" error="could not find a KV slot for the batch - try reducing the size of the batch or increase the context. code: 1" time=2024-11-17T09:22:11.167+01:00 level=ERROR source=runner.go:429 msg="failed to decode batch" error="could not find a KV slot for the batch - try reducing the size of the batch or increase the context. code: 1" time=2024-11-17T09:22:11.370+01:00 level=ERROR source=runner.go:429 msg="failed to decode batch" error="could not find a KV slot for the batch - try reducing the size of the batch or increase the context. code: 1" time=2024-11-17T09:22:11.590+01:00 level=ERROR source=runner.go:429 msg="failed to decode batch" error="could not find a KV slot for the batch - try reducing the size of the batch or increase the context. code: 1" ```
Author
Owner

@jessegross commented on GitHub (Nov 21, 2024):

@fce2 (or others that are experiencing this issue), can you give it a try with 0.4.3-rc0 (or later)? I believe that this error should be fixed now.

<!-- gh-comment-id:2492003779 --> @jessegross commented on GitHub (Nov 21, 2024): @fce2 (or others that are experiencing this issue), can you give it a try with 0.4.3-rc0 (or later)? I believe that this error should be fixed now.
Author
Owner

@fce2 commented on GitHub (Nov 22, 2024):

Hi Jesse,
just tested with 0.4.3, looks good now !
!! THANKS !!

<!-- gh-comment-id:2493307647 --> @fce2 commented on GitHub (Nov 22, 2024): Hi Jesse, just tested with 0.4.3, looks good now ! !! THANKS !!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#82480