Skip to content

fetch fails with EHOSTUNREACH for non-localhost addresses (Node.js v24.11.0 undici bug) #33757

Closed as not planned

Description

@samang1

Description

Issue: Node.js fetch (undici) fails with EHOSTUNREACH for local network addresses

Title: fetch fails with EHOSTUNREACH for non-localhost addresses (Node.js v24.11.0 undici bug)

Body:

Environment
OpenCode version: 1.17.10
Node.js: v24.11.0
OS: macOS (Apple Silicon)
Provider: Custom Ollama server at http://192.168.1.250:11434/
Description
The AI SDK's HTTP calls fail with EHOSTUNREACH when connecting to a non-localhost address, even though the server is reachable via curl and Node.js require('http').

Steps to Reproduce
Configure a custom provider pointing to a local network address (e.g. http://192.168.1.250:11434/v1)
Run opencode
Select the custom provider model
Send a message
Expected
Connection succeeds and model responds.

Actual
Hangs indefinitely or fails with EHOSTUNREACH. Root cause: Node.js v24.11.0's built-in fetch (undici) has a DNS/networking bug affecting non-localhost addresses. require('http') works fine to the same address.

Workaround
None available within OpenCode. Using NODE_OPTIONS="--dns-result-order=ipv4first" does not resolve it for the AI SDK's fetch calls.

Plugins

No response

OpenCode version

1.17.10

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

Activity

  1. github-actions commented on Jun 25, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    If your issue is distinct (e.g. specifically triggered by Node.js v24.11.0 rather than VPN interfaces or desktop app sandboxing), please add details clarifying the difference.

  2. vasiliy-t commented on Aug 10, 2026

    @vasiliy-t

    I'm running OpenCode Desktop on macOS and trying to connect to a self-hosted model (Qwen running on a local IP like 192.168.x.x)

    In my case fix was to allow opencode to access local network: Open System Settings on your Mac. Navigate to Privacy & Security > Local Network. Find OpenCode in the list. Toggle the switch to ON. Restart OpenCode Desktop.

  3. github-actions commented on Oct 11, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions