docker/cli · error
invalid proto, expected
Error message
invalid proto, expected %s: %s
What it means
parseSimpleProtoAddr handles unix and npipe addresses. After stripping the expected proto:// prefix it rejects any value that still contains '://', i.e. a nested or repeated scheme such as unix://tcp://x. The address must be a plain socket path for the given proto.
Solutions
- Provide a single scheme: unix:///var/run/docker.sock or unix://path.
- Remove any nested '://' from the socket path.
- For Windows named pipes use npipe://./pipe/docker_engine.
- Validate that the address contains at most one '://' before calling parseSimpleProtoAddr.
Example fix
# before docker -H unix://tcp://x ps # after docker -H unix:///var/run/docker.sock ps
Defensive patterns
Strategy: validation
Validate before calling
// Reject nested schemes for unix/npipe addresses.
func noNestedScheme(addr string) error {
if strings.Count(addr, "://") > 1 {
return fmt.Errorf("nested scheme in %q", addr)
}
return nil
} Prevention
- Provide a single scheme per -H value.
- For unix sockets use unix:///path or unix://path only.
- Validate that the address contains at most one '://'.
When it happens
Trigger: -H with a doubled or nested scheme for unix/npipe, e.g. -H unix://tcp://x, -H npipe://foo://bar, or otherwise embedding '://' inside a unix/npipe address.
Common situations: Chaining schemes by mistake; malformed socket path containing a colon-slash sequence; copy-paste mixing two -H examples.
Related errors
- invalid bind address format
- invalid proto, expected tcp
- invalid spec
- invalid count ( ): value must be either "all" or an integer
- gpu request key ' ' can be specified only once
AI-assisted analysis of docker/cli@4f84911bfe (2026-08-07).
Data as JSON: /api/errors/d16d709f844ddff2.
Report an issue: GitHub.
Appendix: source
Thrown at opts/hosts.go:86
case "npipe":
return parseSimpleProtoAddr(proto, host, defaultNamedPipe)
case "fd":
return addr, nil
case "ssh":
return addr, nil
default:
return "", fmt.Errorf("invalid bind address format: %s", addr)
}
}
// parseSimpleProtoAddr parses and validates that the specified address is a valid
// socket address for simple protocols like unix and npipe. It returns a formatted
// socket address, either using the address parsed from addr, or the contents of
// defaultAddr if addr is a blank string.
func parseSimpleProtoAddr(proto, addr, defaultAddr string) (string, error) {
addr = strings.TrimPrefix(addr, proto+"://")
if strings.Contains(addr, "://") {
return "", fmt.Errorf("invalid proto, expected %s: %s", proto, addr)
}
if addr == "" {
addr = defaultAddr
}
return fmt.Sprintf("%s://%s", proto, addr), nil
}
// ParseTCPAddr parses and validates that the specified address is a valid TCP
// address. It returns a formatted TCP address, either using the address parsed
// from tryAddr, or the contents of defaultAddr if tryAddr is a blank string.
// tryAddr is expected to have already been Trim()'d
// defaultAddr must be in the full `tcp://host:port` form
func ParseTCPAddr(tryAddr string, defaultAddr string) (string, error) {
if tryAddr == "" || tryAddr == "tcp://" {
return defaultAddr, nil
}
addr := strings.TrimPrefix(tryAddr, "tcp://")
if strings.Contains(addr, "://") || addr == "" {View on GitHub (pinned to 4f84911bfe)