ollama - 💡(How to fix) Fix ollama crashed when posting image to qwen3.5:27b model [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

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#14749Fetched 2026-04-08 00:32:09
View on GitHub
Comments
1
Participants
2
Timeline
3
Reactions
0
Author
Participants
Timeline (top)
closed ×1commented ×1labeled ×1

Error Message

❯ vision -i test/AP202603091820403506.pdf -o test/qwen.txt -c qwen.json [2026-03-10 08:53:56.877] [INFO] [vision:185] Input file: "test/AP202603091820403506.pdf" [2026-03-10 08:53:56.878] [INFO] [vision:186] Output text: "test/qwen.txt" [2026-03-10 08:53:56.878] [INFO] [vision:191] Using VML URL: http://172.16.8.107:11434/v1 [2026-03-10 08:53:56.878] [INFO] [vision:192] Using model: qwen3.5:27b [2026-03-10 08:53:56.878] [INFO] [vision:196] Detected file type: Pdf [2026-03-10 08:53:57.033] [INFO] [vision:172] Converted page 1 to image successfully [2026-03-10 08:53:57.140] [INFO] [vision:172] Converted page 2 to image successfully [2026-03-10 08:53:57.231] [INFO] [vision:172] Converted page 3 to image successfully [2026-03-10 08:53:57.301] [INFO] [vision:172] Converted page 4 to image successfully [2026-03-10 08:53:57.367] [INFO] [vision:172] Converted page 5 to image successfully [2026-03-10 08:53:57.403] [INFO] [vision:172] Converted page 6 to image successfully [2026-03-10 08:53:57.404] [INFO] [vision:206] Successfully converted PDF to 6 images [2026-03-10 08:53:57.404] [INFO] [vision:222] Processing page 1 with VLM.. [2026-03-10 08:53:57.449] [DEBUG] [ureq::stream:395] connecting to 172.16.8.107:11434 at 172.16.8.107:11434 [2026-03-10 08:53:57.450] [DEBUG] [ureq::stream:202] created stream: Stream(TcpStream { addr: 172.16.8.107:60406, peer: 172.16.8.107:11434, fd: 3 }) [2026-03-10 08:53:57.450] [DEBUG] [ureq::unit:261] sending request POST http://172.16.8.107:11434/v1/chat/completions [2026-03-10 08:53:57.450] [DEBUG] [ureq::unit:480] writing prelude: POST /v1/chat/completions HTTP/1.1 Host: 172.16.8.107:11434 User-Agent: ureq/2.12.1 Accept: / Content-Type: application/json accept-encoding: gzip Content-Length: 3783642 [2026-03-10 08:54:26.891] [DEBUG] [ureq::response:396] Body entirely buffered (length: 206) [2026-03-10 08:54:26.891] [DEBUG] [ureq::pool:130] adding stream to pool: http|172.16.8.107|11434 -> Stream(TcpStream { addr: 172.16.8.107:60406, peer: 172.16.8.107:11434, fd: 3 }) [2026-03-10 08:54:26.891] [DEBUG] [ureq::unit:314] response 500 to POST http://172.16.8.107:11434/v1/chat/completions [2026-03-10 08:54:26.891] [DEBUG] [ureq::stream:322] dropping stream: Stream(TcpStream { addr: 172.16.8.107:60406, peer: 172.16.8.107:11434, fd: 3 }) Error: Failed to OCR page 1

Caused by: 0: Failed to connect to VML server at http://172.16.8.107:11434/v1 1: http://172.16.8.107:11434/v1/chat/completions: status code 500

Root Cause

Caused by: 0: Failed to connect to VML server at http://172.16.8.107:11434/v1 1: http://172.16.8.107:11434/v1/chat/completions: status code 500

Code Example

❯ vision -i test/AP202603091820403506.pdf -o test/qwen.txt -c qwen.json
[2026-03-10 08:53:56.877] [INFO] [vision:185] Input file: "test/AP202603091820403506.pdf"
[2026-03-10 08:53:56.878] [INFO] [vision:186] Output text: "test/qwen.txt"
[2026-03-10 08:53:56.878] [INFO] [vision:191] Using VML URL: http://172.16.8.107:11434/v1
[2026-03-10 08:53:56.878] [INFO] [vision:192] Using model: qwen3.5:27b
[2026-03-10 08:53:56.878] [INFO] [vision:196] Detected file type: Pdf
[2026-03-10 08:53:57.033] [INFO] [vision:172] Converted page 1 to image successfully
[2026-03-10 08:53:57.140] [INFO] [vision:172] Converted page 2 to image successfully
[2026-03-10 08:53:57.231] [INFO] [vision:172] Converted page 3 to image successfully
[2026-03-10 08:53:57.301] [INFO] [vision:172] Converted page 4 to image successfully
[2026-03-10 08:53:57.367] [INFO] [vision:172] Converted page 5 to image successfully
[2026-03-10 08:53:57.403] [INFO] [vision:172] Converted page 6 to image successfully
[2026-03-10 08:53:57.404] [INFO] [vision:206] Successfully converted PDF to 6 images
[2026-03-10 08:53:57.404] [INFO] [vision:222] Processing page 1 with VLM..
[2026-03-10 08:53:57.449] [DEBUG] [ureq::stream:395] connecting to 172.16.8.107:11434 at 172.16.8.107:11434
[2026-03-10 08:53:57.450] [DEBUG] [ureq::stream:202] created stream: Stream(TcpStream { addr: 172.16.8.107:60406, peer: 172.16.8.107:11434, fd: 3 })
[2026-03-10 08:53:57.450] [DEBUG] [ureq::unit:261] sending request POST http://172.16.8.107:11434/v1/chat/completions
[2026-03-10 08:53:57.450] [DEBUG] [ureq::unit:480] writing prelude: POST /v1/chat/completions HTTP/1.1
Host: 172.16.8.107:11434
User-Agent: ureq/2.12.1
Accept: */*
Content-Type: application/json
accept-encoding: gzip
Content-Length: 3783642
[2026-03-10 08:54:26.891] [DEBUG] [ureq::response:396] Body entirely buffered (length: 206)
[2026-03-10 08:54:26.891] [DEBUG] [ureq::pool:130] adding stream to pool: http|172.16.8.107|11434 -> Stream(TcpStream { addr: 172.16.8.107:60406, peer: 172.16.8.107:11434, fd: 3 })
[2026-03-10 08:54:26.891] [DEBUG] [ureq::unit:314] response 500 to POST http://172.16.8.107:11434/v1/chat/completions
[2026-03-10 08:54:26.891] [DEBUG] [ureq::stream:322] dropping stream: Stream(TcpStream { addr: 172.16.8.107:60406, peer: 172.16.8.107:11434, fd: 3 })
Error: Failed to OCR page 1

Caused by:
    0: Failed to connect to VML server at http://172.16.8.107:11434/v1
    1: http://172.16.8.107:11434/v1/chat/completions: status code 500

---
RAW_BUFFERClick to expand / collapse

What is the issue?

I use the openai /v1/chat/completions API to post a image to ollama qwen3.5:27b multimodal model, the ollama daemon crashed. My image size as described Content-Length: 3783642.

The ollama system logs attached: ollama-logs.txt

My testing output

❯ vision -i test/AP202603091820403506.pdf -o test/qwen.txt -c qwen.json
[2026-03-10 08:53:56.877] [INFO] [vision:185] Input file: "test/AP202603091820403506.pdf"
[2026-03-10 08:53:56.878] [INFO] [vision:186] Output text: "test/qwen.txt"
[2026-03-10 08:53:56.878] [INFO] [vision:191] Using VML URL: http://172.16.8.107:11434/v1
[2026-03-10 08:53:56.878] [INFO] [vision:192] Using model: qwen3.5:27b
[2026-03-10 08:53:56.878] [INFO] [vision:196] Detected file type: Pdf
[2026-03-10 08:53:57.033] [INFO] [vision:172] Converted page 1 to image successfully
[2026-03-10 08:53:57.140] [INFO] [vision:172] Converted page 2 to image successfully
[2026-03-10 08:53:57.231] [INFO] [vision:172] Converted page 3 to image successfully
[2026-03-10 08:53:57.301] [INFO] [vision:172] Converted page 4 to image successfully
[2026-03-10 08:53:57.367] [INFO] [vision:172] Converted page 5 to image successfully
[2026-03-10 08:53:57.403] [INFO] [vision:172] Converted page 6 to image successfully
[2026-03-10 08:53:57.404] [INFO] [vision:206] Successfully converted PDF to 6 images
[2026-03-10 08:53:57.404] [INFO] [vision:222] Processing page 1 with VLM..
[2026-03-10 08:53:57.449] [DEBUG] [ureq::stream:395] connecting to 172.16.8.107:11434 at 172.16.8.107:11434
[2026-03-10 08:53:57.450] [DEBUG] [ureq::stream:202] created stream: Stream(TcpStream { addr: 172.16.8.107:60406, peer: 172.16.8.107:11434, fd: 3 })
[2026-03-10 08:53:57.450] [DEBUG] [ureq::unit:261] sending request POST http://172.16.8.107:11434/v1/chat/completions
[2026-03-10 08:53:57.450] [DEBUG] [ureq::unit:480] writing prelude: POST /v1/chat/completions HTTP/1.1
Host: 172.16.8.107:11434
User-Agent: ureq/2.12.1
Accept: */*
Content-Type: application/json
accept-encoding: gzip
Content-Length: 3783642
[2026-03-10 08:54:26.891] [DEBUG] [ureq::response:396] Body entirely buffered (length: 206)
[2026-03-10 08:54:26.891] [DEBUG] [ureq::pool:130] adding stream to pool: http|172.16.8.107|11434 -> Stream(TcpStream { addr: 172.16.8.107:60406, peer: 172.16.8.107:11434, fd: 3 })
[2026-03-10 08:54:26.891] [DEBUG] [ureq::unit:314] response 500 to POST http://172.16.8.107:11434/v1/chat/completions
[2026-03-10 08:54:26.891] [DEBUG] [ureq::stream:322] dropping stream: Stream(TcpStream { addr: 172.16.8.107:60406, peer: 172.16.8.107:11434, fd: 3 })
Error: Failed to OCR page 1

Caused by:
    0: Failed to connect to VML server at http://172.16.8.107:11434/v1
    1: http://172.16.8.107:11434/v1/chat/completions: status code 500

Relevant log output

OS

Linux

GPU

Nvidia

CPU

Intel

Ollama version

0.17.4

extent analysis

Fix Plan

The issue seems to be related to the large image size being sent to the OpenAI API, causing a 500 error. To fix this, we can try the following steps:

  • Split the image into smaller chunks: Instead of sending the entire image at once, we can split it into smaller chunks and send them separately.
  • Use a more efficient image compression algorithm: We can try using a more efficient image compression algorithm to reduce the size of the image.
  • Increase the timeout value: We can try increasing the timeout value to give the API more time to process the image.

Here is an example of how we can modify the code to split the image into smaller chunks:

import requests

# Define the API endpoint and the image file
api_endpoint = "http://172.16.8.107:11434/v1/chat/completions"
image_file = "test/AP202603091820403506.pdf"

# Define the chunk size
chunk_size = 1024 * 1024  # 1MB

# Open the image file in binary mode
with open(image_file, "rb") as f:
    # Read the image file in chunks
    chunks = [f.read(chunk_size) for f in [f]]

    # Send each chunk separately
    for i, chunk in enumerate(chunks):
        # Create a new request for each chunk
        headers = {
            "Content-Type": "application/json",
            "Content-Length": str(len(chunk)),
        }
        response = requests.post(api_endpoint, headers=headers, data=chunk)

        # Check if the response was successful
        if response.status_code != 200:
            print(f"Error sending chunk {i+1}: {response.text}")
            break

Verification

To verify that the fix worked, we can check the response status code and the response text. If the response status code is 200 and the response text is empty, it means that the image was sent successfully.

if response.status_code == 200 and response.text == "":
    print("Image sent successfully")
else:
    print(f"Error sending image: {response.text}")

Extra Tips

  • Make sure to adjust the chunk size according to the size of the image and the API's limitations.
  • Consider using a more efficient image compression algorithm to reduce the size of the image.
  • Make sure to handle any errors that may occur during the sending process.

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