docker/compose · error
socket address is too long: %s
Error message
socket address is too long: %s
What it means
Before dialing a Unix socket, memnet validates that the path fits in sockaddr_un.Path (108 bytes on Linux, ~104 on macOS) — the kernel hard limit for Unix socket addresses. A longer path cannot be represented in the sockaddr, so dial would fail with a cryptic EINVAL/ENAMETOOLONG; validateSocketPath fails fast with the offending path instead.
Source
Thrown at internal/memnet/conn_unix.go:36
package memnet
import (
"context"
"fmt"
"net"
"syscall"
)
const maxUnixSocketPathSize = len(syscall.RawSockaddrUnix{}.Path)
func dialNamedPipe(_ context.Context, _ string) (net.Conn, error) {
return nil, fmt.Errorf("named pipes are only available on Windows")
}
func validateSocketPath(addr string) error {
if len(addr) > maxUnixSocketPathSize {
return fmt.Errorf("socket address is too long: %s", addr)
}
return nil
}
View on GitHub (pinned to ddc4b044b6)
Solutions
- Shorten the socket path: create sockets in /tmp, $XDG_RUNTIME_DIR root, or another shallow directory.
- Compute and assert path length before creating/dialing: len(path) < 108 on Linux (104 on macOS).
- Use abstract Unix sockets only if the API supports them (this path-based API does not).
- Move long-running CI workloads to a shorter checkout directory (e.g. /w or /srv) if the path comes from the workspace.
Example fix
# before: socket path too long unix:///home/user/work/very/long/nested/path/runtime/dir/docker-api-proxy.sock # after unix:///tmp/dd-proxy.sock
Defensive patterns
Strategy: validation
Validate before calling
const maxUnixPath = 104 // conservative across linux(108)/macOS(104)
func socketPathFits(p string) bool { return len(p) <= maxUnixPath }
if !socketPathFits(path) { /* pick a shorter dir */ } Try / catch
conn, err := memnet.Dial(ctx, "unix", addr)
if err != nil {
if len(addr) > 104 {
err = fmt.Errorf("socket path too long (%d bytes); move socket to a shallow dir: %w", len(addr), err)
}
return nil, err
} Prevention
- Create sockets under /tmp, /run, or $XDG_RUNTIME_DIR, not deep project trees.
- Assert path length before bind/dial in tests.
- Shorten long CI checkout paths.
When it happens
Trigger: Calling memnet.Dial/DialEndpoint with a unix:// address whose path exceeds the platform sockaddr_un.Path size — e.g. sockets created deep under long project directories (common with testcontainers, tmpdirs nested in $PWD, or XDG_RUNTIME_DIR with long usernames).
Common situations: CI checkout paths like /home/runner/work/very-long-repo-and-branch-name/... plus nested temp dirs pushing the socket path past ~104 chars; Docker contexts whose socket lives under a deeply nested runtime dir; tests generating sockets under t.TempDir() inside long absolute paths.
Related errors
- unsupported protocol for address: %s
- unsupported network: %s
- service %q build.platforms does not support value set by DOC
- service %q build configuration does not support platform: %s
- named pipes are only available on Windows
AI-assisted analysis of docker/compose@ddc4b044b6 (2026-08-15).
Data as JSON: /api/errors/9c078e966106d995.
Report an issue: GitHub.