ollama - 💡(How to fix) Fix Stream Error with Codex: stream closed before response.complete [8 comments, 3 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#14600Fetched 2026-04-08 00:33:56
View on GitHub
Comments
8
Participants
3
Timeline
12
Reactions
0
Author
Timeline (top)
commented ×8closed ×1labeled ×1mentioned ×1

Error Message

When I try to use Codex with Ollama, I often get this error: stream error: stream disconnected before completion: stream closed before response.complete time=2026-03-03T18:37:25.055-05:00 level=WARN source=qwen3.go:108 msg="qwen3 tool call parsing failed" error="failed to parse JSON: unexpected end of JSON input" time=2026-03-03T18:37:28.155-05:00 level=WARN source=qwen3.go:108 msg="qwen3 tool call parsing failed" error="failed to parse JSON: unexpected end of JSON input" time=2026-03-03T18:37:31.713-05:00 level=WARN source=qwen3.go:108 msg="qwen3 tool call parsing failed" error="failed to parse JSON: invalid character ']' after object key:value pair" time=2026-03-03T18:37:35.804-05:00 level=WARN source=qwen3.go:108 msg="qwen3 tool call parsing failed" error="failed to parse JSON: unexpected end of JSON input" time=2026-03-03T18:37:40.452-05:00 level=WARN source=qwen3.go:108 msg="qwen3 tool call parsing failed" error="failed to parse JSON: unexpected end of JSON input" time=2026-03-03T18:37:47.252-05:00 level=WARN source=qwen3.go:108 msg="qwen3 tool call parsing failed" error="failed to parse JSON: unexpected end of JSON input"

Code Example

[GIN] 2026/03/03 - 18:37:21 | 200 | 24.921095417s |  192.168.99.177 | POST     "/v1/responses"
time=2026-03-03T18:37:21.878-05:00 level=DEBUG source=sched.go:587 msg="context for request finished"
time=2026-03-03T18:37:21.878-05:00 level=DEBUG source=sched.go:338 msg="runner with non-zero duration has gone idle, adding timer" runner.name=registry.ollama.ai/library/qwen3.5:35b-a3b-q8_0 runner.inference="[{ID:0 Library:Metal}]" runner.size="39.8 GiB" runner.vram="39.8 GiB" runner.parallel=1 runner.pid=38713 runner.model=/Users/cgk/.ollama/models/blobs/sha256-acd3c29c18f07df11b02809f1787803dbf0ba97abcd16c26e38b75168fce79e0 runner.num_ctx=64000 duration=5m0s
time=2026-03-03T18:37:21.879-05:00 level=DEBUG source=sched.go:356 msg="after processing request finished event" runner.name=registry.ollama.ai/library/qwen3.5:35b-a3b-q8_0 runner.inference="[{ID:0 Library:Metal}]" runner.size="39.8 GiB" runner.vram="39.8 GiB" runner.parallel=1 runner.pid=38713 runner.model=/Users/cgk/.ollama/models/blobs/sha256-acd3c29c18f07df11b02809f1787803dbf0ba97abcd16c26e38b75168fce79e0 runner.num_ctx=64000 refCount=0
time=2026-03-03T18:37:22.021-05:00 level=DEBUG source=sched.go:736 msg="evaluating already loaded" model=/Users/cgk/.ollama/models/blobs/sha256-acd3c29c18f07df11b02809f1787803dbf0ba97abcd16c26e38b75168fce79e0
time=2026-03-03T18:37:22.029-05:00 level=DEBUG source=server.go:1537 msg="completion request" images=0 prompt=38778 format=""
time=2026-03-03T18:37:22.037-05:00 level=DEBUG source=cache.go:151 msg="loading cache slot" id=0 cache=8751 prompt=8861 used=8604 remaining=257
time=2026-03-03T18:37:25.055-05:00 level=WARN source=qwen3.go:108 msg="qwen3 tool call parsing failed" error="failed to parse JSON: unexpected end of JSON input"
[GIN] 2026/03/03 - 18:37:25 | 200 |  3.143320333s |  192.168.99.177 | POST     "/v1/responses"
time=2026-03-03T18:37:25.055-05:00 level=DEBUG source=sched.go:433 msg="context for request finished" runner.name=registry.ollama.ai/library/qwen3.5:35b-a3b-q8_0 runner.inference="[{ID:0 Library:Metal}]" runner.size="39.8 GiB" runner.vram="39.8 GiB" runner.parallel=1 runner.pid=38713 runner.model=/Users/cgk/.ollama/models/blobs/sha256-acd3c29c18f07df11b02809f1787803dbf0ba97abcd16c26e38b75168fce79e0 runner.num_ctx=64000
time=2026-03-03T18:37:25.055-05:00 level=DEBUG source=sched.go:338 msg="runner with non-zero duration has gone idle, adding timer" runner.name=registry.ollama.ai/library/qwen3.5:35b-a3b-q8_0 runner.inference="[{ID:0 Library:Metal}]" runner.size="39.8 GiB" runner.vram="39.8 GiB" runner.parallel=1 runner.pid=38713 runner.model=/Users/cgk/.ollama/models/blobs/sha256-acd3c29c18f07df11b02809f1787803dbf0ba97abcd16c26e38b75168fce79e0 runner.num_ctx=64000 duration=5m0s
time=2026-03-03T18:37:25.055-05:00 level=DEBUG source=sched.go:356 msg="after processing request finished event" runner.name=registry.ollama.ai/library/qwen3.5:35b-a3b-q8_0 runner.inference="[{ID:0 Library:Metal}]" runner.size="39.8 GiB" runner.vram="39.8 GiB" runner.parallel=1 runner.pid=38713 runner.model=/Users/cgk/.ollama/models/blobs/sha256-acd3c29c18f07df11b02809f1787803dbf0ba97abcd16c26e38b75168fce79e0 runner.num_ctx=64000 refCount=0
time=2026-03-03T18:37:25.480-05:00 level=DEBUG source=sched.go:736 msg="evaluating already loaded" model=/Users/cgk/.ollama/models/blobs/sha256-acd3c29c18f07df11b02809f1787803dbf0ba97abcd16c26e38b75168fce79e0
time=2026-03-03T18:37:25.488-05:00 level=DEBUG source=server.go:1537 msg="completion request" images=0 prompt=38778 format=""
time=2026-03-03T18:37:25.500-05:00 level=DEBUG source=cache.go:151 msg="loading cache slot" id=0 cache=8940 prompt=8861 used=8604 remaining=257
time=2026-03-03T18:37:28.155-05:00 level=WARN source=qwen3.go:108 msg="qwen3 tool call parsing failed" error="failed to parse JSON: unexpected end of JSON input"
[GIN] 2026/03/03 - 18:37:28 | 200 |  2.839764792s |  192.168.99.177 | POST     "/v1/responses"
time=2026-03-03T18:37:28.155-05:00 level=DEBUG source=sched.go:433 msg="context for request finished" runner.name=registry.ollama.ai/library/qwen3.5:35b-a3b-q8_0 runner.inference="[{ID:0 Library:Metal}]" runner.size="39.8 GiB" runner.vram="39.8 GiB" runner.parallel=1 runner.pid=38713 runner.model=/Users/cgk/.ollama/models/blobs/sha256-acd3c29c18f07df11b02809f1787803dbf0ba97abcd16c26e38b75168fce79e0 runner.num_ctx=64000
time=2026-03-03T18:37:28.156-05:00 level=DEBUG source=sched.go:338 msg="runner with non-zero duration has gone idle, adding timer" runner.name=registry.ollama.ai/library/qwen3.5:35b-a3b-q8_0 runner.inference="[{ID:0 Library:Metal}]" runner.size="39.8 GiB" runner.vram="39.8 GiB" runner.parallel=1 runner.pid=38713 runner.model=/Users/cgk/.ollama/models/blobs/sha256-acd3c29c18f07df11b02809f1787803dbf0ba97abcd16c26e38b75168fce79e0 runner.num_ctx=64000 duration=5m0s
time=2026-03-03T18:37:28.156-05:00 level=DEBUG source=sched.go:356 msg="after processing request finished event" runner.name=registry.ollama.ai/library/qwen3.5:35b-a3b-q8_0 runner.inference="[{ID:0 Library:Metal}]" runner.size="39.8 GiB" runner.vram="39.8 GiB" runner.parallel=1 runner.pid=38713 runner.model=/Users/cgk/.ollama/models/blobs/sha256-acd3c29c18f07df11b02809f1787803dbf0ba97abcd16c26e38b75168fce79e0 runner.num_ctx=64000 refCount=0
time=2026-03-03T18:37:28.944-05:00 level=DEBUG source=sched.go:736 msg="evaluating already loaded" model=/Users/cgk/.ollama/models/blobs/sha256-acd3c29c18f07df11b02809f1787803dbf0ba97abcd16c26e38b75168fce79e0
time=2026-03-03T18:37:28.952-05:00 level=DEBUG source=server.go:1537 msg="completion request" images=0 prompt=38778 format=""
time=2026-03-03T18:37:28.960-05:00 level=DEBUG source=cache.go:151 msg="loading cache slot" id=0 cache=8929 prompt=8861 used=8604 remaining=257
time=2026-03-03T18:37:31.713-05:00 level=WARN source=qwen3.go:108 msg="qwen3 tool call parsing failed" error="failed to parse JSON: invalid character ']' after object key:value pair"
[GIN] 2026/03/03 - 18:37:31 | 200 |  2.917049959s |  192.168.99.177 | POST     "/v1/responses"
time=2026-03-03T18:37:31.713-05:00 level=DEBUG source=sched.go:433 msg="context for request finished" runner.name=registry.ollama.ai/library/qwen3.5:35b-a3b-q8_0 runner.inference="[{ID:0 Library:Metal}]" runner.size="39.8 GiB" runner.vram="39.8 GiB" runner.parallel=1 runner.pid=38713 runner.model=/Users/cgk/.ollama/models/blobs/sha256-acd3c29c18f07df11b02809f1787803dbf0ba97abcd16c26e38b75168fce79e0 runner.num_ctx=64000
time=2026-03-03T18:37:31.713-05:00 level=DEBUG source=sched.go:338 msg="runner with non-zero duration has gone idle, adding timer" runner.name=registry.ollama.ai/library/qwen3.5:35b-a3b-q8_0 runner.inference="[{ID:0 Library:Metal}]" runner.size="39.8 GiB" runner.vram="39.8 GiB" runner.parallel=1 runner.pid=38713 runner.model=/Users/cgk/.ollama/models/blobs/sha256-acd3c29c18f07df11b02809f1787803dbf0ba97abcd16c26e38b75168fce79e0 runner.num_ctx=64000 duration=5m0s
time=2026-03-03T18:37:31.713-05:00 level=DEBUG source=sched.go:356 msg="after processing request finished event" runner.name=registry.ollama.ai/library/qwen3.5:35b-a3b-q8_0 runner.inference="[{ID:0 Library:Metal}]" runner.size="39.8 GiB" runner.vram="39.8 GiB" runner.parallel=1 runner.pid=38713 runner.model=/Users/cgk/.ollama/models/blobs/sha256-acd3c29c18f07df11b02809f1787803dbf0ba97abcd16c26e38b75168fce79e0 runner.num_ctx=64000 refCount=0
[GIN] 2026/03/03 - 18:37:31 | 200 |        36.5µs |       127.0.0.1 | HEAD     "/"
[GIN] 2026/03/03 - 18:37:31 | 200 |      42.792µs |       127.0.0.1 | GET      "/api/ps"
time=2026-03-03T18:37:32.668-05:00 level=DEBUG source=sched.go:736 msg="evaluating already loaded" model=/Users/cgk/.ollama/models/blobs/sha256-acd3c29c18f07df11b02809f1787803dbf0ba97abcd16c26e38b75168fce79e0
time=2026-03-03T18:37:32.677-05:00 level=DEBUG source=server.go:1537 msg="completion request" images=0 prompt=38778 format=""
time=2026-03-03T18:37:32.685-05:00 level=DEBUG source=cache.go:151 msg="loading cache slot" id=0 cache=8933 prompt=8861 used=8604 remaining=257
time=2026-03-03T18:37:35.804-05:00 level=WARN source=qwen3.go:108 msg="qwen3 tool call parsing failed" error="failed to parse JSON: unexpected end of JSON input"
[GIN] 2026/03/03 - 18:37:35 | 200 |     3.286773s |  192.168.99.177 | POST     "/v1/responses"
time=2026-03-03T18:37:35.804-05:00 level=DEBUG source=sched.go:433 msg="context for request finished" runner.name=registry.ollama.ai/library/qwen3.5:35b-a3b-q8_0 runner.inference="[{ID:0 Library:Metal}]" runner.size="39.8 GiB" runner.vram="39.8 GiB" runner.parallel=1 runner.pid=38713 runner.model=/Users/cgk/.ollama/models/blobs/sha256-acd3c29c18f07df11b02809f1787803dbf0ba97abcd16c26e38b75168fce79e0 runner.num_ctx=64000
time=2026-03-03T18:37:35.804-05:00 level=DEBUG source=sched.go:338 msg="runner with non-zero duration has gone idle, adding timer" runner.name=registry.ollama.ai/library/qwen3.5:35b-a3b-q8_0 runner.inference="[{ID:0 Library:Metal}]" runner.size="39.8 GiB" runner.vram="39.8 GiB" runner.parallel=1 runner.pid=38713 runner.model=/Users/cgk/.ollama/models/blobs/sha256-acd3c29c18f07df11b02809f1787803dbf0ba97abcd16c26e38b75168fce79e0 runner.num_ctx=64000 duration=5m0s
time=2026-03-03T18:37:35.804-05:00 level=DEBUG source=sched.go:356 msg="after processing request finished event" runner.name=registry.ollama.ai/library/qwen3.5:35b-a3b-q8_0 runner.inference="[{ID:0 Library:Metal}]" runner.size="39.8 GiB" runner.vram="39.8 GiB" runner.parallel=1 runner.pid=38713 runner.model=/Users/cgk/.ollama/models/blobs/sha256-acd3c29c18f07df11b02809f1787803dbf0ba97abcd16c26e38b75168fce79e0 runner.num_ctx=64000 refCount=0
time=2026-03-03T18:37:37.547-05:00 level=DEBUG source=sched.go:736 msg="evaluating already loaded" model=/Users/cgk/.ollama/models/blobs/sha256-acd3c29c18f07df11b02809f1787803dbf0ba97abcd16c26e38b75168fce79e0
time=2026-03-03T18:37:37.556-05:00 level=DEBUG source=server.go:1537 msg="completion request" images=0 prompt=38778 format=""
time=2026-03-03T18:37:37.564-05:00 level=DEBUG source=cache.go:151 msg="loading cache slot" id=0 cache=8943 prompt=8861 used=8604 remaining=257
time=2026-03-03T18:37:40.452-05:00 level=WARN source=qwen3.go:108 msg="qwen3 tool call parsing failed" error="failed to parse JSON: unexpected end of JSON input"
[GIN] 2026/03/03 - 18:37:40 | 200 |  3.054015084s |  192.168.99.177 | POST     "/v1/responses"
time=2026-03-03T18:37:40.453-05:00 level=DEBUG source=sched.go:433 msg="context for request finished" runner.name=registry.ollama.ai/library/qwen3.5:35b-a3b-q8_0 runner.inference="[{ID:0 Library:Metal}]" runner.size="39.8 GiB" runner.vram="39.8 GiB" runner.parallel=1 runner.pid=38713 runner.model=/Users/cgk/.ollama/models/blobs/sha256-acd3c29c18f07df11b02809f1787803dbf0ba97abcd16c26e38b75168fce79e0 runner.num_ctx=64000
time=2026-03-03T18:37:40.453-05:00 level=DEBUG source=sched.go:338 msg="runner with non-zero duration has gone idle, adding timer" runner.name=registry.ollama.ai/library/qwen3.5:35b-a3b-q8_0 runner.inference="[{ID:0 Library:Metal}]" runner.size="39.8 GiB" runner.vram="39.8 GiB" runner.parallel=1 runner.pid=38713 runner.model=/Users/cgk/.ollama/models/blobs/sha256-acd3c29c18f07df11b02809f1787803dbf0ba97abcd16c26e38b75168fce79e0 runner.num_ctx=64000 duration=5m0s
time=2026-03-03T18:37:40.453-05:00 level=DEBUG source=sched.go:356 msg="after processing request finished event" runner.name=registry.ollama.ai/library/qwen3.5:35b-a3b-q8_0 runner.inference="[{ID:0 Library:Metal}]" runner.size="39.8 GiB" runner.vram="39.8 GiB" runner.parallel=1 runner.pid=38713 runner.model=/Users/cgk/.ollama/models/blobs/sha256-acd3c29c18f07df11b02809f1787803dbf0ba97abcd16c26e38b75168fce79e0 runner.num_ctx=64000 refCount=0
time=2026-03-03T18:37:44.217-05:00 level=DEBUG source=sched.go:736 msg="evaluating already loaded" model=/Users/cgk/.ollama/models/blobs/sha256-acd3c29c18f07df11b02809f1787803dbf0ba97abcd16c26e38b75168fce79e0
time=2026-03-03T18:37:44.226-05:00 level=DEBUG source=server.go:1537 msg="completion request" images=0 prompt=38778 format=""
time=2026-03-03T18:37:44.234-05:00 level=DEBUG source=cache.go:151 msg="loading cache slot" id=0 cache=8936 prompt=8861 used=8604 remaining=257
time=2026-03-03T18:37:47.252-05:00 level=WARN source=qwen3.go:108 msg="qwen3 tool call parsing failed" error="failed to parse JSON: unexpected end of JSON input"
[GIN] 2026/03/03 - 18:37:47 | 200 |  3.195688125s |  192.168.99.177 | POST     "/v1/responses"
time=2026-03-03T18:37:47.252-05:00 level=DEBUG source=sched.go:433 msg="context for request finished" runner.name=registry.ollama.ai/library/qwen3.5:35b-a3b-q8_0 runner.inference="[{ID:0 Library:Metal}]" runner.size="39.8 GiB" runner.vram="39.8 GiB" runner.parallel=1 runner.pid=38713 runner.model=/Users/cgk/.ollama/models/blobs/sha256-acd3c29c18f07df11b02809f1787803dbf0ba97abcd16c26e38b75168fce79e0 runner.num_ctx=64000
time=2026-03-03T18:37:47.252-05:00 level=DEBUG source=sched.go:338 msg="runner with non-zero duration has gone idle, adding timer" runner.name=registry.ollama.ai/library/qwen3.5:35b-a3b-q8_0 runner.inference="[{ID:0 Library:Metal}]" runner.size="39.8 GiB" runner.vram="39.8 GiB" runner.parallel=1 runner.pid=38713 runner.model=/Users/cgk/.ollama/models/blobs/sha256-acd3c29c18f07df11b02809f1787803dbf0ba97abcd16c26e38b75168fce79e0 runner.num_ctx=64000 duration=5m0s
time=2026-03-03T18:37:47.252-05:00 level=DEBUG source=sched.go:356 msg="after processing request finished event" runner.name=registry.ollama.ai/library/qwen3.5:35b-a3b-q8_0 runner.inference="[{ID:0 Library:Metal}]" runner.size="39.8 GiB" runner.vram="39.8 GiB" runner.parallel=1 runner.pid=38713 runner.model=/Users/cgk/.ollama/models/blobs/sha256-acd3c29c18f07df11b02809f1787803dbf0ba97abcd16c26e38b75168fce79e0 runner.num_ctx=64000 refCount=0
RAW_BUFFERClick to expand / collapse

What is the issue?

When I try to use Codex with Ollama, I often get this error: stream error: stream disconnected before completion: stream closed before response.complete My codex-cli is 0.104.0. I also set stream_idle_timeout_ms = 600000 in Codex.

Relevant log output

[GIN] 2026/03/03 - 18:37:21 | 200 | 24.921095417s |  192.168.99.177 | POST     "/v1/responses"
time=2026-03-03T18:37:21.878-05:00 level=DEBUG source=sched.go:587 msg="context for request finished"
time=2026-03-03T18:37:21.878-05:00 level=DEBUG source=sched.go:338 msg="runner with non-zero duration has gone idle, adding timer" runner.name=registry.ollama.ai/library/qwen3.5:35b-a3b-q8_0 runner.inference="[{ID:0 Library:Metal}]" runner.size="39.8 GiB" runner.vram="39.8 GiB" runner.parallel=1 runner.pid=38713 runner.model=/Users/cgk/.ollama/models/blobs/sha256-acd3c29c18f07df11b02809f1787803dbf0ba97abcd16c26e38b75168fce79e0 runner.num_ctx=64000 duration=5m0s
time=2026-03-03T18:37:21.879-05:00 level=DEBUG source=sched.go:356 msg="after processing request finished event" runner.name=registry.ollama.ai/library/qwen3.5:35b-a3b-q8_0 runner.inference="[{ID:0 Library:Metal}]" runner.size="39.8 GiB" runner.vram="39.8 GiB" runner.parallel=1 runner.pid=38713 runner.model=/Users/cgk/.ollama/models/blobs/sha256-acd3c29c18f07df11b02809f1787803dbf0ba97abcd16c26e38b75168fce79e0 runner.num_ctx=64000 refCount=0
time=2026-03-03T18:37:22.021-05:00 level=DEBUG source=sched.go:736 msg="evaluating already loaded" model=/Users/cgk/.ollama/models/blobs/sha256-acd3c29c18f07df11b02809f1787803dbf0ba97abcd16c26e38b75168fce79e0
time=2026-03-03T18:37:22.029-05:00 level=DEBUG source=server.go:1537 msg="completion request" images=0 prompt=38778 format=""
time=2026-03-03T18:37:22.037-05:00 level=DEBUG source=cache.go:151 msg="loading cache slot" id=0 cache=8751 prompt=8861 used=8604 remaining=257
time=2026-03-03T18:37:25.055-05:00 level=WARN source=qwen3.go:108 msg="qwen3 tool call parsing failed" error="failed to parse JSON: unexpected end of JSON input"
[GIN] 2026/03/03 - 18:37:25 | 200 |  3.143320333s |  192.168.99.177 | POST     "/v1/responses"
time=2026-03-03T18:37:25.055-05:00 level=DEBUG source=sched.go:433 msg="context for request finished" runner.name=registry.ollama.ai/library/qwen3.5:35b-a3b-q8_0 runner.inference="[{ID:0 Library:Metal}]" runner.size="39.8 GiB" runner.vram="39.8 GiB" runner.parallel=1 runner.pid=38713 runner.model=/Users/cgk/.ollama/models/blobs/sha256-acd3c29c18f07df11b02809f1787803dbf0ba97abcd16c26e38b75168fce79e0 runner.num_ctx=64000
time=2026-03-03T18:37:25.055-05:00 level=DEBUG source=sched.go:338 msg="runner with non-zero duration has gone idle, adding timer" runner.name=registry.ollama.ai/library/qwen3.5:35b-a3b-q8_0 runner.inference="[{ID:0 Library:Metal}]" runner.size="39.8 GiB" runner.vram="39.8 GiB" runner.parallel=1 runner.pid=38713 runner.model=/Users/cgk/.ollama/models/blobs/sha256-acd3c29c18f07df11b02809f1787803dbf0ba97abcd16c26e38b75168fce79e0 runner.num_ctx=64000 duration=5m0s
time=2026-03-03T18:37:25.055-05:00 level=DEBUG source=sched.go:356 msg="after processing request finished event" runner.name=registry.ollama.ai/library/qwen3.5:35b-a3b-q8_0 runner.inference="[{ID:0 Library:Metal}]" runner.size="39.8 GiB" runner.vram="39.8 GiB" runner.parallel=1 runner.pid=38713 runner.model=/Users/cgk/.ollama/models/blobs/sha256-acd3c29c18f07df11b02809f1787803dbf0ba97abcd16c26e38b75168fce79e0 runner.num_ctx=64000 refCount=0
time=2026-03-03T18:37:25.480-05:00 level=DEBUG source=sched.go:736 msg="evaluating already loaded" model=/Users/cgk/.ollama/models/blobs/sha256-acd3c29c18f07df11b02809f1787803dbf0ba97abcd16c26e38b75168fce79e0
time=2026-03-03T18:37:25.488-05:00 level=DEBUG source=server.go:1537 msg="completion request" images=0 prompt=38778 format=""
time=2026-03-03T18:37:25.500-05:00 level=DEBUG source=cache.go:151 msg="loading cache slot" id=0 cache=8940 prompt=8861 used=8604 remaining=257
time=2026-03-03T18:37:28.155-05:00 level=WARN source=qwen3.go:108 msg="qwen3 tool call parsing failed" error="failed to parse JSON: unexpected end of JSON input"
[GIN] 2026/03/03 - 18:37:28 | 200 |  2.839764792s |  192.168.99.177 | POST     "/v1/responses"
time=2026-03-03T18:37:28.155-05:00 level=DEBUG source=sched.go:433 msg="context for request finished" runner.name=registry.ollama.ai/library/qwen3.5:35b-a3b-q8_0 runner.inference="[{ID:0 Library:Metal}]" runner.size="39.8 GiB" runner.vram="39.8 GiB" runner.parallel=1 runner.pid=38713 runner.model=/Users/cgk/.ollama/models/blobs/sha256-acd3c29c18f07df11b02809f1787803dbf0ba97abcd16c26e38b75168fce79e0 runner.num_ctx=64000
time=2026-03-03T18:37:28.156-05:00 level=DEBUG source=sched.go:338 msg="runner with non-zero duration has gone idle, adding timer" runner.name=registry.ollama.ai/library/qwen3.5:35b-a3b-q8_0 runner.inference="[{ID:0 Library:Metal}]" runner.size="39.8 GiB" runner.vram="39.8 GiB" runner.parallel=1 runner.pid=38713 runner.model=/Users/cgk/.ollama/models/blobs/sha256-acd3c29c18f07df11b02809f1787803dbf0ba97abcd16c26e38b75168fce79e0 runner.num_ctx=64000 duration=5m0s
time=2026-03-03T18:37:28.156-05:00 level=DEBUG source=sched.go:356 msg="after processing request finished event" runner.name=registry.ollama.ai/library/qwen3.5:35b-a3b-q8_0 runner.inference="[{ID:0 Library:Metal}]" runner.size="39.8 GiB" runner.vram="39.8 GiB" runner.parallel=1 runner.pid=38713 runner.model=/Users/cgk/.ollama/models/blobs/sha256-acd3c29c18f07df11b02809f1787803dbf0ba97abcd16c26e38b75168fce79e0 runner.num_ctx=64000 refCount=0
time=2026-03-03T18:37:28.944-05:00 level=DEBUG source=sched.go:736 msg="evaluating already loaded" model=/Users/cgk/.ollama/models/blobs/sha256-acd3c29c18f07df11b02809f1787803dbf0ba97abcd16c26e38b75168fce79e0
time=2026-03-03T18:37:28.952-05:00 level=DEBUG source=server.go:1537 msg="completion request" images=0 prompt=38778 format=""
time=2026-03-03T18:37:28.960-05:00 level=DEBUG source=cache.go:151 msg="loading cache slot" id=0 cache=8929 prompt=8861 used=8604 remaining=257
time=2026-03-03T18:37:31.713-05:00 level=WARN source=qwen3.go:108 msg="qwen3 tool call parsing failed" error="failed to parse JSON: invalid character ']' after object key:value pair"
[GIN] 2026/03/03 - 18:37:31 | 200 |  2.917049959s |  192.168.99.177 | POST     "/v1/responses"
time=2026-03-03T18:37:31.713-05:00 level=DEBUG source=sched.go:433 msg="context for request finished" runner.name=registry.ollama.ai/library/qwen3.5:35b-a3b-q8_0 runner.inference="[{ID:0 Library:Metal}]" runner.size="39.8 GiB" runner.vram="39.8 GiB" runner.parallel=1 runner.pid=38713 runner.model=/Users/cgk/.ollama/models/blobs/sha256-acd3c29c18f07df11b02809f1787803dbf0ba97abcd16c26e38b75168fce79e0 runner.num_ctx=64000
time=2026-03-03T18:37:31.713-05:00 level=DEBUG source=sched.go:338 msg="runner with non-zero duration has gone idle, adding timer" runner.name=registry.ollama.ai/library/qwen3.5:35b-a3b-q8_0 runner.inference="[{ID:0 Library:Metal}]" runner.size="39.8 GiB" runner.vram="39.8 GiB" runner.parallel=1 runner.pid=38713 runner.model=/Users/cgk/.ollama/models/blobs/sha256-acd3c29c18f07df11b02809f1787803dbf0ba97abcd16c26e38b75168fce79e0 runner.num_ctx=64000 duration=5m0s
time=2026-03-03T18:37:31.713-05:00 level=DEBUG source=sched.go:356 msg="after processing request finished event" runner.name=registry.ollama.ai/library/qwen3.5:35b-a3b-q8_0 runner.inference="[{ID:0 Library:Metal}]" runner.size="39.8 GiB" runner.vram="39.8 GiB" runner.parallel=1 runner.pid=38713 runner.model=/Users/cgk/.ollama/models/blobs/sha256-acd3c29c18f07df11b02809f1787803dbf0ba97abcd16c26e38b75168fce79e0 runner.num_ctx=64000 refCount=0
[GIN] 2026/03/03 - 18:37:31 | 200 |        36.5µs |       127.0.0.1 | HEAD     "/"
[GIN] 2026/03/03 - 18:37:31 | 200 |      42.792µs |       127.0.0.1 | GET      "/api/ps"
time=2026-03-03T18:37:32.668-05:00 level=DEBUG source=sched.go:736 msg="evaluating already loaded" model=/Users/cgk/.ollama/models/blobs/sha256-acd3c29c18f07df11b02809f1787803dbf0ba97abcd16c26e38b75168fce79e0
time=2026-03-03T18:37:32.677-05:00 level=DEBUG source=server.go:1537 msg="completion request" images=0 prompt=38778 format=""
time=2026-03-03T18:37:32.685-05:00 level=DEBUG source=cache.go:151 msg="loading cache slot" id=0 cache=8933 prompt=8861 used=8604 remaining=257
time=2026-03-03T18:37:35.804-05:00 level=WARN source=qwen3.go:108 msg="qwen3 tool call parsing failed" error="failed to parse JSON: unexpected end of JSON input"
[GIN] 2026/03/03 - 18:37:35 | 200 |     3.286773s |  192.168.99.177 | POST     "/v1/responses"
time=2026-03-03T18:37:35.804-05:00 level=DEBUG source=sched.go:433 msg="context for request finished" runner.name=registry.ollama.ai/library/qwen3.5:35b-a3b-q8_0 runner.inference="[{ID:0 Library:Metal}]" runner.size="39.8 GiB" runner.vram="39.8 GiB" runner.parallel=1 runner.pid=38713 runner.model=/Users/cgk/.ollama/models/blobs/sha256-acd3c29c18f07df11b02809f1787803dbf0ba97abcd16c26e38b75168fce79e0 runner.num_ctx=64000
time=2026-03-03T18:37:35.804-05:00 level=DEBUG source=sched.go:338 msg="runner with non-zero duration has gone idle, adding timer" runner.name=registry.ollama.ai/library/qwen3.5:35b-a3b-q8_0 runner.inference="[{ID:0 Library:Metal}]" runner.size="39.8 GiB" runner.vram="39.8 GiB" runner.parallel=1 runner.pid=38713 runner.model=/Users/cgk/.ollama/models/blobs/sha256-acd3c29c18f07df11b02809f1787803dbf0ba97abcd16c26e38b75168fce79e0 runner.num_ctx=64000 duration=5m0s
time=2026-03-03T18:37:35.804-05:00 level=DEBUG source=sched.go:356 msg="after processing request finished event" runner.name=registry.ollama.ai/library/qwen3.5:35b-a3b-q8_0 runner.inference="[{ID:0 Library:Metal}]" runner.size="39.8 GiB" runner.vram="39.8 GiB" runner.parallel=1 runner.pid=38713 runner.model=/Users/cgk/.ollama/models/blobs/sha256-acd3c29c18f07df11b02809f1787803dbf0ba97abcd16c26e38b75168fce79e0 runner.num_ctx=64000 refCount=0
time=2026-03-03T18:37:37.547-05:00 level=DEBUG source=sched.go:736 msg="evaluating already loaded" model=/Users/cgk/.ollama/models/blobs/sha256-acd3c29c18f07df11b02809f1787803dbf0ba97abcd16c26e38b75168fce79e0
time=2026-03-03T18:37:37.556-05:00 level=DEBUG source=server.go:1537 msg="completion request" images=0 prompt=38778 format=""
time=2026-03-03T18:37:37.564-05:00 level=DEBUG source=cache.go:151 msg="loading cache slot" id=0 cache=8943 prompt=8861 used=8604 remaining=257
time=2026-03-03T18:37:40.452-05:00 level=WARN source=qwen3.go:108 msg="qwen3 tool call parsing failed" error="failed to parse JSON: unexpected end of JSON input"
[GIN] 2026/03/03 - 18:37:40 | 200 |  3.054015084s |  192.168.99.177 | POST     "/v1/responses"
time=2026-03-03T18:37:40.453-05:00 level=DEBUG source=sched.go:433 msg="context for request finished" runner.name=registry.ollama.ai/library/qwen3.5:35b-a3b-q8_0 runner.inference="[{ID:0 Library:Metal}]" runner.size="39.8 GiB" runner.vram="39.8 GiB" runner.parallel=1 runner.pid=38713 runner.model=/Users/cgk/.ollama/models/blobs/sha256-acd3c29c18f07df11b02809f1787803dbf0ba97abcd16c26e38b75168fce79e0 runner.num_ctx=64000
time=2026-03-03T18:37:40.453-05:00 level=DEBUG source=sched.go:338 msg="runner with non-zero duration has gone idle, adding timer" runner.name=registry.ollama.ai/library/qwen3.5:35b-a3b-q8_0 runner.inference="[{ID:0 Library:Metal}]" runner.size="39.8 GiB" runner.vram="39.8 GiB" runner.parallel=1 runner.pid=38713 runner.model=/Users/cgk/.ollama/models/blobs/sha256-acd3c29c18f07df11b02809f1787803dbf0ba97abcd16c26e38b75168fce79e0 runner.num_ctx=64000 duration=5m0s
time=2026-03-03T18:37:40.453-05:00 level=DEBUG source=sched.go:356 msg="after processing request finished event" runner.name=registry.ollama.ai/library/qwen3.5:35b-a3b-q8_0 runner.inference="[{ID:0 Library:Metal}]" runner.size="39.8 GiB" runner.vram="39.8 GiB" runner.parallel=1 runner.pid=38713 runner.model=/Users/cgk/.ollama/models/blobs/sha256-acd3c29c18f07df11b02809f1787803dbf0ba97abcd16c26e38b75168fce79e0 runner.num_ctx=64000 refCount=0
time=2026-03-03T18:37:44.217-05:00 level=DEBUG source=sched.go:736 msg="evaluating already loaded" model=/Users/cgk/.ollama/models/blobs/sha256-acd3c29c18f07df11b02809f1787803dbf0ba97abcd16c26e38b75168fce79e0
time=2026-03-03T18:37:44.226-05:00 level=DEBUG source=server.go:1537 msg="completion request" images=0 prompt=38778 format=""
time=2026-03-03T18:37:44.234-05:00 level=DEBUG source=cache.go:151 msg="loading cache slot" id=0 cache=8936 prompt=8861 used=8604 remaining=257
time=2026-03-03T18:37:47.252-05:00 level=WARN source=qwen3.go:108 msg="qwen3 tool call parsing failed" error="failed to parse JSON: unexpected end of JSON input"
[GIN] 2026/03/03 - 18:37:47 | 200 |  3.195688125s |  192.168.99.177 | POST     "/v1/responses"
time=2026-03-03T18:37:47.252-05:00 level=DEBUG source=sched.go:433 msg="context for request finished" runner.name=registry.ollama.ai/library/qwen3.5:35b-a3b-q8_0 runner.inference="[{ID:0 Library:Metal}]" runner.size="39.8 GiB" runner.vram="39.8 GiB" runner.parallel=1 runner.pid=38713 runner.model=/Users/cgk/.ollama/models/blobs/sha256-acd3c29c18f07df11b02809f1787803dbf0ba97abcd16c26e38b75168fce79e0 runner.num_ctx=64000
time=2026-03-03T18:37:47.252-05:00 level=DEBUG source=sched.go:338 msg="runner with non-zero duration has gone idle, adding timer" runner.name=registry.ollama.ai/library/qwen3.5:35b-a3b-q8_0 runner.inference="[{ID:0 Library:Metal}]" runner.size="39.8 GiB" runner.vram="39.8 GiB" runner.parallel=1 runner.pid=38713 runner.model=/Users/cgk/.ollama/models/blobs/sha256-acd3c29c18f07df11b02809f1787803dbf0ba97abcd16c26e38b75168fce79e0 runner.num_ctx=64000 duration=5m0s
time=2026-03-03T18:37:47.252-05:00 level=DEBUG source=sched.go:356 msg="after processing request finished event" runner.name=registry.ollama.ai/library/qwen3.5:35b-a3b-q8_0 runner.inference="[{ID:0 Library:Metal}]" runner.size="39.8 GiB" runner.vram="39.8 GiB" runner.parallel=1 runner.pid=38713 runner.model=/Users/cgk/.ollama/models/blobs/sha256-acd3c29c18f07df11b02809f1787803dbf0ba97abcd16c26e38b75168fce79e0 runner.num_ctx=64000 refCount=0

OS

macOS

GPU

Apple

CPU

Apple

Ollama version

0.17.5

extent analysis

Fix Plan

The issue seems to be related to the stream_idle_timeout_ms configuration and JSON parsing errors. To fix this, we'll increase the timeout and improve JSON parsing.

Step 1: Increase stream_idle_timeout_ms

Increase the stream_idle_timeout_ms to a higher value, e.g., 1200000 (20 minutes), to allow for longer stream connections.

stream_idle_timeout_ms = 1200000

Step 2: Improve JSON Parsing

Modify the qwen3.go file to handle JSON parsing errors more robustly. Specifically, add error handling for json.Unmarshal to prevent panics.

func parseJson(data []byte) {
    var jsonData map[string]interface{}
    err := json.Unmarshal(data, &jsonData)
    if err != nil {
        log.Printf("Error parsing JSON: %v", err)
        return
    }
    // Process jsonData
}

Step 3: Update Ollama Configuration

Update the Ollama configuration to include the increased stream_idle_timeout_ms value.

ollama:
  stream_idle_timeout_ms: 1200000

Verification

After applying these changes, restart the Ollama service and verify that the stream error messages are no longer present in the logs. You can also test the JSON parsing by sending a request with a valid JSON payload.

Extra Tips

  • Regularly review and update the Ollama configuration to ensure optimal performance and prevent similar issues.
  • Consider implementing additional error handling and logging mechanisms to improve debugging and troubleshooting capabilities.
  • If issues persist, try increasing the stream_idle_timeout_ms value further or exploring other configuration options to optimize the stream connection settings.

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