Skip to content

[Bug]: OpenClaw cannot reliably connect to remote Ollama/LM Studio instances via LAN IP — fetch failed / Connection error on every request despite direct curl and Node.js fetch working fine #60994

@tnowakow

Description

@tnowakow

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

OpenClaw cannot reliably connect to remote Ollama/LM Studio instances via LAN IP — fetch failed / Connection error on every request despite direct curl and Node.js fetch working fine

Steps to reproduce

Steps to Reproduce

Install OpenClaw globally on a Mac (macOS 15.0.1, Node.js v25.8.1):

bash npm install -g openclaw

On a separate Windows machine on the same LAN, install and start Ollama with a model loaded and OLLAMA_HOST=0.0.0.0 set so it accepts remote connections. Verify it's reachable from the Mac:

bash curl http://192.168.1.10:11434/api/tags

Returns model list ✅

Verify Node.js fetch works from the Mac (same runtime as OpenClaw):

bash node -e "fetch('http://192.168.1.10:11434/v1/chat/completions', {method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({model:'qwen3-coder:30b',messages:[{role:'user',content:'hi'}]})}).then(r=>r.json()).then(console.log).catch(console.error)"

Returns valid completion ✅

Configure OpenClaw to use the remote Ollama instance:

bash openclaw config set models.providers.ollama.baseUrl "http://192.168.1.10:11434"
openclaw config set agents.defaults.model.primary "ollama/qwen3-coder:30b"
openclaw gateway restart

Send a message through any connected channel (e.g. Telegram).
Observe the error in logs:

LLM request failed: network connection error.
rawErrorPreview: "fetch failed"
rawErrorHash: sha256:e2c73a8fd237

Confirm the issue is in OpenClaw's HTTP client layer by running a Node.js localhost proxy:

bash node -e "
const http = require('http');
http.createServer((req,res)=>{
const opts={hostname:'192.168.1.10',port:11434,path:req.url,method:req.method,headers:{...req.headers,host:'192.168.1.10:11434'}};
const p=http.request(opts,r=>{res.writeHead(r.statusCode,r.headers);r.pipe(res)});
p.on('error',e=>{res.writeHead(502);res.end(e.message)});
req.pipe(p);
}).listen(11434,'127.0.0.1',()=>console.log('Proxy ready'))
" &
openclaw config set models.providers.ollama.baseUrl "http://127.0.0.1:11434"
openclaw gateway restart

Send a message again — it works when routed through localhost proxy, confirming OpenClaw's HTTP client fails on LAN IPs but succeeds on loopback.

Expected result: Step 5 succeeds — OpenClaw connects to the remote Ollama instance directly via LAN IP, just as curl and Node.js fetch do.
Actual result: Step 5 fails with fetch failed / network connection error on every attempt. The workaround in steps 7-8 is required.
Secondary bug — slug generator hardcoded timeout:
After applying the localhost proxy workaround, a secondary issue appears: the internal slug generator has a hardcoded 15-second timeout that cannot be overridden:
bashopenclaw config set agents.defaults.timeoutSeconds 180

Has no effect on slug generator — it still times out at 15s

Log evidence:
warn agent/embedded embedded run timeout:
runId=slug-gen-* timeoutMs=15000
This causes all requests to fail when the model takes more than 15 seconds to respond on first load, even if agents.defaults.timeoutSeconds is set higher. The slug generator timeout should be user-configurable or the feature should be optional.

Expected behavior

Run OpenClaw on a Mac Mini (macOS 15.0.1) using a local LLM hosted on a separate Windows Server 2025 machine on the same LAN. Expected behaviour: OpenClaw sends requests to the remote Ollama or LM Studio server at http://192.168.1.10:11434 (or port 1234) and receives completions, exactly as curl and Node.js native fetch do successfully from the same machine.

Actual behavior

Every single LLM request fails with one of these errors:
LLM request failed: network connection error.
rawErrorPreview: "fetch failed"
or
LLM request failed: network connection error.
rawErrorPreview: "Connection error."
status: 408
The error hash sha256:e2c73a8fd237 is identical on every failure across restarts, config changes, version rollbacks, and reboots — suggesting a cached or structural failure rather than a transient network issue.
Additionally, the internal slug generator has a hardcoded 15-second timeout that cannot be overridden via agents.defaults.timeoutSeconds, causing it to fail before the main agent even runs when using slower local models.

OpenClaw version

2026.4.2 (d74a122) — also reproduced on 2026.3.31 and 2026.4.1

Operating system

macOS 15.0.1 (x64), Windows Server 2025

Install method

curl -fsSL https://openclaw.ai/install.sh | bash

Model

qwen/qwen3-coder-30b, google/gemma-4-26b-a4b, ollama/qwen3.5:9b

Provider / routing chain

openclaw -> windows server (firewall disabled)

Additional provider/model setup details

No response

Logs, screenshots, and evidence

All of the following work perfectly from the Mac Mini:
bash# Direct curl to Ollama
curl http://192.168.1.10:11434/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{"model":"qwen3-coder:30b","messages":[{"role":"user","content":"hi"}],"stream":true}'
# ✅ Streams tokens correctly

# Node.js native fetch (same runtime OpenClaw uses)
node -e "fetch('http://192.168.1.10:11434/v1/chat/completions', {
  method:'POST',
  headers:{'Content-Type':'application/json'},
  body: JSON.stringify({model:'qwen3-coder:30b',messages:[{role:'user',content:'hi'}]})
}).then(r=>r.json()).then(console.log).catch(console.error)"
# ✅ Returns valid response

# LM Studio direct curl
curl http://192.168.1.10:1234/v1/models
# ✅ Returns model list
Workaround found: A Node.js reverse proxy running on localhost that forwards to the remote machine fixes the issue — OpenClaw connects to 127.0.0.1 successfully but fails on any LAN IP.

What I ran / config snippet
json{
  "models": {
    "providers": {
      "ollama": {
        "baseUrl": "http://192.168.1.10:11434",
        "apiKey": "ollama-local",
        "api": "ollama",
        "models": [
          {
            "id": "qwen3-coder:30b",
            "contextWindow": 131072,
            "maxTokens": 8192
          }
        ]
      }
    }
  },
  "agents": {
    "defaults": {
      "model": {
        "primary": "ollama/qwen3-coder:30b",
        "fallbacks": []
      },
      "timeoutSeconds": 180
    }
  }
}
Commands run:
bashopenclaw config set models.providers.ollama.baseUrl "http://192.168.1.10:11434"
openclaw config set agents.defaults.model.primary "ollama/qwen3-coder:30b"
openclaw config set agents.defaults.timeoutSeconds 180
openclaw gateway restart

Environment
ItemValueOpenClaw version2026.4.2 (d74a122) — also reproduced on 2026.3.31 and 2026.4.1Install methodnpm global (npm install -g openclaw)Mac Mini OSmacOS 15.0.1 (x64)Node.js versionv25.8.1LLM server OSWindows Server 2025Ollama version0.18.3LM Studio version0.4.9 Build 1GPU (EPYC machine)NVIDIA RTX 3090 (24GB VRAM)NetworkBoth machines on same LAN subnet (192.168.1.x)

Relevant logs
Ollama provider — fetch failed on every attempt despite remote being reachable:
warn agent/embedded {"event":"embedded_run_agent_end","isError":true,
  "error":"LLM request failed: network connection error.",
  "failoverReason":"timeout","model":"qwen3-coder:30b","provider":"ollama",
  "rawErrorPreview":"fetch failed","rawErrorHash":"sha256:e2c73a8fd237"}

warn agent/embedded {"event":"embedded_run_failover_decision",
  "decision":"surface_error","failoverReason":"timeout",
  "provider":"ollama","model":"qwen3-coder:30b",
  "fallbackConfigured":false,"timedOut":false,"aborted":false}
LM Studio provider — Connection error with status 408:
warn agent/embedded {"event":"embedded_run_agent_end","isError":true,
  "error":"LLM request failed: network connection error.",
  "model":"google/gemma-4-26b-a4b","provider":"lmstudio",
  "rawErrorPreview":"Connection error.","rawErrorHash":"sha256:8ec9a0b7fe5c",
  "status":408}
Slug generator hardcoded timeout blocking all requests:
warn agent/embedded embedded run timeout: 
  runId=slug-gen-1775316783193 timeoutMs=15000
  
error llm-slug-generator Failed to generate slug: 
  FailoverError: LLM request timed out.
IPv6 fallback warning (possible root cause of fetch failure):
warn fetch fallback: enabling sticky IPv4-only dispatcher 
  (codes=UND_ERR_CONNECT_TIMEOUT)

Additional notes

The fetch fallback: enabling sticky IPv4-only dispatcher log line appeared during Telegram channel setup and may indicate OpenClaw's HTTP client attempts IPv6 first, which fails, but unlike the Telegram channel code path, the LLM provider code path does not recover gracefully from the IPv6 failure
The workaround (Node.js localhost proxy) confirms the issue is in OpenClaw's HTTP client layer, not the network or LLM servers
agents.defaults.timeoutSeconds has no effect on the slug generator's hardcoded 15s timeout — this should either be configurable or the slug generator should be optional/disableable

Impact and severity

Local LLM won't run and even if it does through the network tunnel trick, it stops after a few prompts

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingbug:behaviorIncorrect behavior without a crash

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions