docker/compose · error
unsupported network: %s
Error message
unsupported network: %s
What it means
The lower-level memnet.Dial switch only implements the "unix" and "npipe" networks; any other network string ("tcp", "udp", an empty string, "UNIX" with wrong case) hits the default arm and fails immediately without dialing. This is separate from error 87: DialEndpoint parses the scheme and calls Dial with the canonical network name, so seeing this from DialEndpoint means the scheme matched but was mapped unexpectedly — more often it appears when code calls Dial directly.
Source
Thrown at internal/memnet/conn.go:48
if addr, ok := strings.CutPrefix(endpoint, "npipe://"); ok {
return Dial(ctx, "npipe", addr)
}
return nil, fmt.Errorf("unsupported protocol for address: %s", endpoint)
}
func Dial(ctx context.Context, network, addr string) (net.Conn, error) {
var d net.Dialer
switch network {
case "unix":
if err := validateSocketPath(addr); err != nil {
return nil, err
}
return d.DialContext(ctx, "unix", addr)
case "npipe":
// N.B. this will return an error on non-Windows
return dialNamedPipe(ctx, addr)
default:
return nil, fmt.Errorf("unsupported network: %s", network)
}
}
View on GitHub (pinned to ddc4b044b6)
Solutions
- Pass one of the two supported network names: Dial(ctx, "unix", "/path/to.sock") or Dial(ctx, "npipe", pipeName) on Windows.
- For TCP endpoints, use net.Dialer.DialContext directly — memnet intentionally does not support it.
- Centralize the scheme→network mapping in one place (as DialEndpoint does) instead of ad-hoc call sites.
Example fix
// before
conn, err := memnet.Dial(ctx, "tcp", "127.0.0.1:2375") // unsupported
// after
conn, err := (&net.Dialer{}).DialContext(ctx, "tcp", "127.0.0.1:2375") Defensive patterns
Strategy: validation
Validate before calling
switch network {
case "unix", "npipe": // ok
default:
return fmt.Errorf("memnet supports unix/npipe, got %q", network)
}
conn, err := memnet.Dial(ctx, network, addr) Type guard
func supportedNetwork(n string) bool { return n == "unix" || n == "npipe" } Try / catch
conn, err := memnet.Dial(ctx, network, addr)
if err != nil {
return fmt.Errorf("memnet dial %s %s: %w", network, addr, err)
} Prevention
- Only pass the literal network names 'unix' and 'npipe'.
- Keep scheme parsing in DialEndpoint instead of hand-mapping at call sites.
- Use net.Dialer for tcp/udp.
When it happens
Trigger: Calling memnet.Dial(ctx, network, addr) with network other than exactly "unix" or "npipe" — e.g. "tcp", "tcp4", "", or a scheme string like "unix://" passed as the network argument by mistake.
Common situations: Reusing a generic dial helper that passes scheme:// strings where a bare network name is expected; empty network after defaults are applied incorrectly; copied code that assumed net.Dial's accepted networks.
Related errors
- unsupported protocol for address: %s
- named pipes are only available on Windows
- socket address is too long: %s
- invalid digest %s: %w
- invalid PID (%d): only positive PIDs are allowed
AI-assisted analysis of docker/compose@ddc4b044b6 (2026-08-15).
Data as JSON: /api/errors/cc976d961718fc91.
Report an issue: GitHub.