{"record":{"id":"645e7314fa3d0015","repo":"docker/cli","slug":"no-scheme-provided","errorCode":null,"errorMessage":"no scheme provided","messagePattern":"no scheme provided","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/connhelper/ssh/ssh.go","lineNumber":43,"sourceCode":"}\n\n// NewSpec creates a [Spec] from the given ssh URL's properties. It returns\n// an error if the URL is using the wrong scheme, contains fragments,\n// query-parameters, or contains a password.\nfunc NewSpec(sshURL *url.URL) (*Spec, error) {\n\ts, err := newSpec(sshURL)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"invalid SSH URL: %w\", err)\n\t}\n\treturn s, nil\n}\n\nfunc newSpec(u *url.URL) (*Spec, error) {\n\tif u == nil {\n\t\treturn nil, errors.New(\"URL is nil\")\n\t}\n\tif u.Scheme == \"\" {\n\t\treturn nil, errors.New(\"no scheme provided\")\n\t}\n\tif u.Scheme != \"ssh\" {\n\t\treturn nil, errors.New(\"incorrect scheme: \" + u.Scheme)\n\t}\n\n\tvar sp Spec\n\n\tif u.User != nil {\n\t\tsp.User = u.User.Username()\n\t\tif _, ok := u.User.Password(); ok {\n\t\t\treturn nil, errors.New(\"plain-text password is not supported\")\n\t\t}\n\t}\n\tsp.Host = u.Hostname()\n\tif sp.Host == \"\" {\n\t\treturn nil, errors.New(\"hostname is empty\")\n\t}\n\tsp.Port = u.Port()","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/docker/cli/blob/4f84911bfe8811e9b028e4b1fee8e7510be79387/cli/connhelper/ssh/ssh.go#L25-L61","documentation":"Returned by the SSH connection helper's newSpec when the parsed URL has an empty Scheme. The helper only understands ssh:// URLs, so a URL with no scheme (e.g. a bare 'host:port' or 'user@host') is treated as invalid because its structure is ambiguous.","triggerScenarios":"Setting DOCKER_HOST to a value without a scheme, or calling ssh.ParseURL/NewSpec with a string like '1.2.3.4:2375' or 'user@host'. The url package leaves Scheme empty for such inputs.","commonSituations":"A user sets DOCKER_HOST=host:port intending TCP but the value routes into the SSH helper. A misconfigured remote Docker host string missing the 'ssh://' prefix.","solutions":["Prefix the URL with the ssh scheme: 'ssh://user@host'.","If you meant a plain TCP connection, use 'tcp://host:2375' so it does not enter the SSH helper.","For a local socket, use 'unix:///var/run/docker.sock'."],"exampleFix":"# before\nDOCKER_HOST=user@remote-host\n# after\nDOCKER_HOST=ssh://user@remote-host","handlingStrategy":"validation","validationCode":"// Ensure a scheme is present before passing to ssh.ParseURL.\nfunc ensureScheme(host string) string {\n    if !strings.Contains(host, \"://\") {\n        return \"ssh://\" + host\n    }\n    return host\n}","typeGuard":"func hasScheme(u string) bool {\n    return strings.Contains(u, \"://\")\n}","tryCatchPattern":null,"preventionTips":["Always include the scheme in DOCKER_HOST.","Use 'tcp://' for TCP, 'ssh://' for SSH, 'unix://' for sockets.","Document the expected DOCKER_HOST format in your runbooks."],"tags":["ssh","connhelper","docker-host","url-parsing"],"backgroundTag":null,"analyzedSha":"4f84911bfe8811e9b028e4b1fee8e7510be79387","analyzedAt":"2026-08-07T12:15:29.814Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}