{"record":{"id":"7befb9221fb5d45f","repo":"docker/compose","slug":"unsupported-protocol-for-address-s","errorCode":null,"errorMessage":"unsupported protocol for address: %s","messagePattern":"unsupported protocol for address: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/memnet/conn.go","lineNumber":33,"sourceCode":"*/\n\npackage memnet\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"net\"\n\t\"strings\"\n)\n\nfunc DialEndpoint(ctx context.Context, endpoint string) (net.Conn, error) {\n\tif addr, ok := strings.CutPrefix(endpoint, \"unix://\"); ok {\n\t\treturn Dial(ctx, \"unix\", addr)\n\t}\n\tif addr, ok := strings.CutPrefix(endpoint, \"npipe://\"); ok {\n\t\treturn Dial(ctx, \"npipe\", addr)\n\t}\n\treturn nil, fmt.Errorf(\"unsupported protocol for address: %s\", endpoint)\n}\n\nfunc Dial(ctx context.Context, network, addr string) (net.Conn, error) {\n\tvar d net.Dialer\n\tswitch network {\n\tcase \"unix\":\n\t\tif err := validateSocketPath(addr); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn d.DialContext(ctx, \"unix\", addr)\n\tcase \"npipe\":\n\t\t// N.B. this will return an error on non-Windows\n\t\treturn dialNamedPipe(ctx, addr)\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unsupported network: %s\", network)\n\t}\n}\n","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/docker/compose/blob/ddc4b044b62e9f715212ea4143fa830fac76382f/internal/memnet/conn.go#L15-L51","documentation":"memnet.DialEndpoint only accepts endpoints prefixed with unix:// or npipe://; anything else (tcp://, http://, a bare path, an empty string, or a typo like unix:/ or npipes://) falls through to this error before any dial is attempted. It is a strict, fail-fast contract: memnet exists to talk over local sockets, not TCP.","triggerScenarios":"Calling memnet.DialEndpoint(ctx, endpoint) with an endpoint string that lacks an exact unix:// or npipe:// prefix — e.g. \"/var/run/docker.sock\", \"tcp://127.0.0.1:2375\", \"unix:///var/run/x.sock\" is fine but \"UNIX://...\" (case) is not (CutPrefix is case-sensitive).","commonSituations":"Passing DOCKER_HOST-style values straight through without normalizing (docker uses unix:///path with three slashes and also bare paths); config files storing \"tcp://\" endpoints fed to a socket-only dialer; empty endpoint after failed config parsing; trailing whitespace breaking the prefix match.","solutions":["Prefix the value correctly: unix:///var/run/docker.sock (scheme + absolute path) or npipe:////./pipe/docker_engine on Windows.","Trim whitespace and validate the endpoint string before calling DialEndpoint.","If you need TCP, use net.Dialer.DialContext(\"tcp\", addr) instead of memnet.DialEndpoint — memnet deliberately rejects it.","Normalize at the config boundary so only validated endpoints reach the dialer."],"exampleFix":"// before\nconn, err := memnet.DialEndpoint(ctx, os.Getenv(\"DOCKER_HOST\")) // may be \"tcp://...\" or bare path\n\n// after\nep := strings.TrimSpace(endpoint)\nif !strings.HasPrefix(ep, \"unix://\") && !strings.HasPrefix(ep, \"npipe://\") {\n    ep = \"unix://\" + ep // bare socket path\n}\nconn, err := memnet.DialEndpoint(ctx, ep)","handlingStrategy":"validation","validationCode":"func validMemnetEndpoint(ep string) bool {\n    return strings.HasPrefix(ep, \"unix://\") || strings.HasPrefix(ep, \"npipe://\")\n}\nif !validMemnetEndpoint(endpoint) {\n    return fmt.Errorf(\"endpoint %q must be unix:// or npipe://\", endpoint)\n}","typeGuard":"func isUnixEndpoint(ep string) bool { return strings.HasPrefix(ep, \"unix://\") }\nfunc isNpipeEndpoint(ep string) bool { return strings.HasPrefix(ep, \"npipe://\") }","tryCatchPattern":"conn, err := memnet.DialEndpoint(ctx, ep)\nif err != nil {\n    return fmt.Errorf(\"dial %s: %w\", ep, err) // surface which endpoint was rejected\n}","preventionTips":["Normalize endpoints to unix:///abs/path or npipe:////./pipe/name at the config boundary.","Trim whitespace and lowercase-check scheme prefixes (CutPrefix is case-sensitive).","Route TCP endpoints to net.Dial, never to memnet."],"tags":["network","unix-socket","named-pipe","validation","go"],"backgroundTag":null,"analyzedSha":"ddc4b044b62e9f715212ea4143fa830fac76382f","analyzedAt":"2026-08-15T13:31:42.319Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}