ollama - 💡(How to fix) Fix Problem with submitting multiple images to qwen3.5:27b as opposed to qwen3.5:397b-cloud [2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
ollama/ollama#15147Fetched 2026-04-08 01:53:02
View on GitHub
Comments
2
Participants
2
Timeline
3
Reactions
0
Author
Participants
Timeline (top)
commented ×2labeled ×1

Error Message

I am facing a problem with qwen3.5:27b when submitting a list of 2-3 images (representing the pages of a same document) along with a single text prompt requiring content extraction of the images. With qwen3.5:397b-cloud, everything runs fine as expected. But with qwen3.5:27b, using exactly the same prompt and same images, I consistently get the following error message: "Internal Server Error -- Failed to create new sequence: SameBatch may not be specified within numKeep (index: 3 numKeep: 4 SameBatch: 2017)". This is true whether using the "generate" or "chat" API endpoints. I located the source of this error message in https://github.com/ollama/ollama/blob/main/runner/ollamarunner/runner.go but I do not see how to circumvent this behavior.

RAW_BUFFERClick to expand / collapse

What is the issue?

I am facing a problem with qwen3.5:27b when submitting a list of 2-3 images (representing the pages of a same document) along with a single text prompt requiring content extraction of the images. With qwen3.5:397b-cloud, everything runs fine as expected. But with qwen3.5:27b, using exactly the same prompt and same images, I consistently get the following error message: "Internal Server Error -- Failed to create new sequence: SameBatch may not be specified within numKeep (index: 3 numKeep: 4 SameBatch: 2017)". This is true whether using the "generate" or "chat" API endpoints. I am using Ollama 0.18.0 running on an NVIDIA L4 GPU with 24Gb VRAM. I located the source of this error message in https://github.com/ollama/ollama/blob/main/runner/ollamarunner/runner.go but I do not see how to circumvent this behavior. Is this a bug, or a normal behavior that can be circumvented by modifying some parameters?

Relevant log output

OS

Linux

GPU

Nvidia

CPU

AMD

Ollama version

0.18.0

extent analysis

Fix Plan

The issue seems to be related to the SameBatch parameter in the numKeep configuration. To fix this, you can try modifying the numKeep value or adjusting the SameBatch parameter.

Here are the steps to follow:

  • Check the numKeep configuration in your Ollama setup and reduce the value to 3 or less.
  • Alternatively, you can try setting SameBatch to a value less than numKeep.

Example code snippet to adjust numKeep:

// In runner.go, update the numKeep value
numKeep := 3

Or, you can modify the SameBatch value:

// In runner.go, update the SameBatch value
SameBatch := 2016

Note: You may need to recompile the Ollama code after making these changes.

Verification

To verify that the fix worked, try submitting the same list of images and text prompt again. If the error persists, you may need to adjust the numKeep or SameBatch values further.

Extra Tips

  • Make sure to check the Ollama documentation for any specific guidelines on configuring numKeep and SameBatch.
  • If you're still experiencing issues, try updating to a newer version of Ollama or seeking support from the Ollama community.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING