openclaw - 💡(How to fix) Fix [Bug]: [Bug]: Ollama provider hangs or fails on infer model run --local across 2026.4.20 / 2026.4.24 / 2026.4.25 with three distinct failure modes [2 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
openclaw/openclaw#72851Fetched 2026-04-28 06:31:25
View on GitHub
Comments
2
Participants
3
Timeline
5
Reactions
0
Timeline (top)
commented ×2labeled ×2closed ×1

The Ollama provider does not deliver responses to the CLI on openclaw infer model run --local and openclaw agent; reproduced across versions 2026.4.20, 2026.4.24, and 2026.4.25 against the same healthy local Ollama instance, with three distinct failure modes confirmed by Ollama gateway logs.

Error Message

  • OpenClaw error: LLM request failed: network connection error. rawError=fetch failed | Headers Timeout Error
  • CLI hangs and fails with Error: gateway timeout after 630000ms (10m 30s).
  • CLI hangs indefinitely with no further log output after [agent/embedded] session file repaired. No error returned, no response delivered.

Root Cause

The Ollama provider does not deliver responses to the CLI on openclaw infer model run --local and openclaw agent; reproduced across versions 2026.4.20, 2026.4.24, and 2026.4.25 against the same healthy local Ollama instance, with three distinct failure modes confirmed by Ollama gateway logs.

Fix Action

Fix / Workaround

  1. Install Ollama 0.21.2, pull qwen2.5-coder:7b, pin warm with keep_alive: -1.
  2. Confirm Ollama works: curl -s http://127.0.0.1:11434/api/chat -d '{"model":"qwen2.5-coder:7b","messages":[{"role":"user","content":"Reply with one word: pong"}],"stream":false}' returns "Pong" in ~6 seconds.
  3. Install OpenClaw with npm install -g openclaw@<version> (tested 2026.4.20, 2026.4.24, 2026.4.25).
  4. Run openclaw --profile d11v3 configure. Select Ollama provider, "Local only" mode, base URL http://127.0.0.1:11434. Select qwen2.5-coder:7b in the model picker.
  5. Approve any pending pairing scope upgrade: openclaw --profile d11v3 devices approve <id>.
  6. Disable bonjour: openclaw --profile d11v3 plugins disable bonjour.
  7. Patch config: set agents.defaults.model.primary to ollama/qwen2.5-coder:7b, agents.defaults.model.fallbacks to [], agents.defaults.llm.idleTimeoutSeconds to 0.
  8. Restart gateway: systemctl --user restart openclaw-gateway-d11v3.
  9. Run: openclaw --profile d11v3 infer model run --local --model ollama/qwen2.5-coder:7b --prompt "Reply with one word: pong" --json.
  10. Observe failure (mode varies by version, see actual behavior).

Workaround tested: none yet successful within OpenClaw. Direct Ollama API calls succeed and were used as a baseline to isolate the failure to OpenClaw's provider layer.

Code Example

Ollama gateway logs (the most diagnostic evidence):

2026.4.20:
Apr 27 14:17:07 [GIN] 2026/04/27 - 14:17:07 | 500 | 5m0s | 127.0.0.1 | POST "/api/chat"

2026.4.24:
Apr 27 04:40:09 [GIN] 2026/04/27 - 04:40:09 | 500 | 1m59s | 127.0.0.1 | POST "/api/chat"
Apr 27 04:40:09 time=2026-04-27T04:40:09.245Z level=INFO source=runner.go:682 msg="aborting completion request due to client closing the connection"
Apr 27 04:54:25 [GIN] 2026/04/27 - 04:54:25 | 500 | 9m59s | 127.0.0.1 | POST "/api/chat"
Apr 27 04:54:25 time=2026-04-27T04:54:25.468Z level=INFO source=runner.go:682 msg="aborting completion request due to client closing the connection"

2026.4.25:
Apr 27 13:35:04 [GIN] 2026/04/27 - 13:35:04 | 200 | 15m4s | 127.0.0.1 | POST "/api/chat"

Direct curl benchmark on same Ollama / same model / equivalent prompt for comparison:
Total: 6.12s, load_duration: 3.44s, prompt_eval_duration: 2.40s, eval_duration: 0.27s, eval_count: 3 tokens.

Full journalctl outputs for each version's test window available on request.
RAW_BUFFERClick to expand / collapse

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

The Ollama provider does not deliver responses to the CLI on openclaw infer model run --local and openclaw agent; reproduced across versions 2026.4.20, 2026.4.24, and 2026.4.25 against the same healthy local Ollama instance, with three distinct failure modes confirmed by Ollama gateway logs.

Steps to reproduce

  1. Install Ollama 0.21.2, pull qwen2.5-coder:7b, pin warm with keep_alive: -1.
  2. Confirm Ollama works: curl -s http://127.0.0.1:11434/api/chat -d '{"model":"qwen2.5-coder:7b","messages":[{"role":"user","content":"Reply with one word: pong"}],"stream":false}' returns "Pong" in ~6 seconds.
  3. Install OpenClaw with npm install -g openclaw@<version> (tested 2026.4.20, 2026.4.24, 2026.4.25).
  4. Run openclaw --profile d11v3 configure. Select Ollama provider, "Local only" mode, base URL http://127.0.0.1:11434. Select qwen2.5-coder:7b in the model picker.
  5. Approve any pending pairing scope upgrade: openclaw --profile d11v3 devices approve <id>.
  6. Disable bonjour: openclaw --profile d11v3 plugins disable bonjour.
  7. Patch config: set agents.defaults.model.primary to ollama/qwen2.5-coder:7b, agents.defaults.model.fallbacks to [], agents.defaults.llm.idleTimeoutSeconds to 0.
  8. Restart gateway: systemctl --user restart openclaw-gateway-d11v3.
  9. Run: openclaw --profile d11v3 infer model run --local --model ollama/qwen2.5-coder:7b --prompt "Reply with one word: pong" --json.
  10. Observe failure (mode varies by version, see actual behavior).

Expected behavior

The CLI returns the model's response within seconds. Direct curl to the same Ollama instance with the same model and an equivalent prompt returns "Pong" in 6.12 seconds (load_duration 3.44s, prompt_eval 2.40s, eval 0.27s, eval_count 3 tokens).

Actual behavior

The CLI does not return a response. Failure mode varies by version:

2026.4.20:

  • CLI fails after exactly 5 minutes 0 seconds.
  • OpenClaw error: LLM request failed: network connection error. rawError=fetch failed | Headers Timeout Error
  • Ollama log: [GIN] POST "/api/chat" | 500 | 5m0s
  • Diagnosis: Node undici fetch hits its default 300-second headersTimeout. Ollama does not return response headers until generation completes (non-streaming response).

2026.4.24:

  • CLI hangs and fails with Error: gateway timeout after 630000ms (10m 30s).
  • Ollama logs: [GIN] POST "/api/chat" | 500 | 1m59s | aborting completion request due to client closing the connection (and 9m59s on a subsequent attempt).
  • Diagnosis: OpenClaw closes the connection mid-generation. Different timing on retries suggests an internal task supervisor, not a fixed value.

2026.4.25:

  • CLI hangs indefinitely with no further log output after [agent/embedded] session file repaired. No error returned, no response delivered.
  • Ollama log: [GIN] POST "/api/chat" | 200 | 15m4s — Ollama generates the full response and returns HTTP 200 successfully.
  • Connection state during the wait: ss -tnp | grep 11434 shows ESTABLISHED throughout.
  • Diagnosis: OpenClaw receives the completed response over the TCP socket but does not deliver it to the CLI caller.

OpenClaw version

2026.4.20 (115f05d), 2026.4.24 (cbcfdf6), 2026.4.25 (aa36ee6) — all three reproduce the failure with different symptoms.

Operating system

Ubuntu 24.04.4 LTS (kernel 6.8.0-110-generic, x86_64)

Install method

npm global (npm install -g openclaw@<version>)

Model

ollama/qwen2.5-coder:7b (Q4_K_M, 7.6B parameters)

Provider / routing chain

openclaw -> ollama (local, http://127.0.0.1:11434)

Additional provider/model setup details

Single hop — local Ollama only, no cloud routing, no proxies, no fallback providers.

Configuration:

  • Ollama base URL: http://127.0.0.1:11434
  • Ollama mode: Local only
  • agents.defaults.model.primary: ollama/qwen2.5-coder:7b
  • agents.defaults.model.fallbacks: []
  • agents.defaults.llm.idleTimeoutSeconds: 0
  • bonjour plugin: disabled
  • Telegram channel: disabled
  • Pairing scope upgrade: approved

Profile config path: /root/.openclaw-d11v3/openclaw.json (clean profile, created via openclaw --profile d11v3 configure).

Auth: provider auth configured via openclaw secrets configure referencing env var OLLAMA_API_KEY=ollama-local-no-key (placeholder, since local Ollama does not require a real key).

Both openclaw agent and openclaw infer model run --local exhibit the same failure modes per version, indicating the bug is at or below the layer common to both invocation paths.

Logs, screenshots, and evidence

Ollama gateway logs (the most diagnostic evidence):

2026.4.20:
Apr 27 14:17:07 [GIN] 2026/04/27 - 14:17:07 | 500 | 5m0s | 127.0.0.1 | POST "/api/chat"

2026.4.24:
Apr 27 04:40:09 [GIN] 2026/04/27 - 04:40:09 | 500 | 1m59s | 127.0.0.1 | POST "/api/chat"
Apr 27 04:40:09 time=2026-04-27T04:40:09.245Z level=INFO source=runner.go:682 msg="aborting completion request due to client closing the connection"
Apr 27 04:54:25 [GIN] 2026/04/27 - 04:54:25 | 500 | 9m59s | 127.0.0.1 | POST "/api/chat"
Apr 27 04:54:25 time=2026-04-27T04:54:25.468Z level=INFO source=runner.go:682 msg="aborting completion request due to client closing the connection"

2026.4.25:
Apr 27 13:35:04 [GIN] 2026/04/27 - 13:35:04 | 200 | 15m4s | 127.0.0.1 | POST "/api/chat"

Direct curl benchmark on same Ollama / same model / equivalent prompt for comparison:
Total: 6.12s, load_duration: 3.44s, prompt_eval_duration: 2.40s, eval_duration: 0.27s, eval_count: 3 tokens.

Full journalctl outputs for each version's test window available on request.

Impact and severity

Affected: All users of openclaw agent and openclaw infer model run --local paired with the Ollama provider on local-only deployments.

Severity: Blocks workflow. The Ollama provider is not operationally usable for interactive CLI inference on any of the three tested versions.

Frequency: 100% reproducible across multiple test runs and three versions on a clean profile with minimal config.

Consequence: Local-first deployments using OpenClaw + Ollama cannot complete model turns through the agent or infer paths. Direct Ollama API calls work, so the failure is specific to OpenClaw's Ollama provider integration.

Additional information

Last known good version: not yet identified. Tested 2026.4.20, 2026.4.24, 2026.4.25 — all three fail in different ways. The failure mode shifts across versions:

  • 2026.4.20: Node fetch headers timeout at 5m exact (Node v22.22.2, undici default headersTimeout=300000ms).
  • 2026.4.24: OpenClaw closes connection mid-generation (1m59s and 9m59s observed; suggests internal task supervisor or watchdog).
  • 2026.4.25: OpenClaw receives complete HTTP 200 response from Ollama but does not deliver to CLI.

Suspected hypotheses (not verified, source not inspected):

  1. Ollama provider HTTP client lacks an extended headersTimeout for non-streaming responses.
  2. Internal task lifecycle management closes provider connections prematurely under some condition.
  3. Response-handling pipeline between provider receipt and CLI delivery has a hang/drop.
  4. The infer model run --local wrapper sends a much larger prompt than the user-supplied text, contributing to multi-minute generation times even when the integration succeeds (15m4s for a 1-word "pong" response is ~150x slower than direct Ollama with the equivalent prompt).

Workaround tested: none yet successful within OpenClaw. Direct Ollama API calls succeed and were used as a baseline to isolate the failure to OpenClaw's provider layer.

extent analysis

TL;DR

The most likely fix involves adjusting the headersTimeout setting in the OpenClaw Ollama provider configuration to accommodate longer response times from the Ollama API.

Guidance

  1. Verify the Ollama provider configuration: Check the OpenClaw configuration file (e.g., /root/.openclaw-d11v3/openclaw.json) to see if there's an option to adjust the headersTimeout for the Ollama provider.
  2. Adjust the headersTimeout setting: If the setting is available, try increasing its value to a higher number (e.g., 600000ms or more) to allow for longer response times from the Ollama API.
  3. Investigate internal task lifecycle management: If adjusting the headersTimeout doesn't work, investigate whether OpenClaw's internal task lifecycle management is closing provider connections prematurely and see if there's a way to adjust this behavior.
  4. Check the response-handling pipeline: Verify that the response-handling pipeline between the provider receipt and CLI delivery is not causing the response to hang or drop.

Example

No specific code example is provided as the issue seems to be related to configuration and internal behavior of OpenClaw rather than a specific code snippet.

Notes

The exact solution may depend on the internal implementation of OpenClaw and its Ollama provider, which is not fully understood from the provided information. Adjusting the headersTimeout setting is a plausible first step based on the error messages and behavior described.

Recommendation

Apply a workaround by adjusting the headersTimeout setting in the OpenClaw Ollama provider configuration, as this is the most direct and least invasive potential fix based on the information provided.

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…

FAQ

Expected behavior

The CLI returns the model's response within seconds. Direct curl to the same Ollama instance with the same model and an equivalent prompt returns "Pong" in 6.12 seconds (load_duration 3.44s, prompt_eval 2.40s, eval 0.27s, eval_count 3 tokens).

Still need to ship something?

×6

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

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix [Bug]: [Bug]: Ollama provider hangs or fails on infer model run --local across 2026.4.20 / 2026.4.24 / 2026.4.25 with three distinct failure modes [2 comments, 3 participants]