{"record":{"id":"02cb2984ecab6958","repo":"docker/cli","slug":"fragments-are-not-allowed-q","errorCode":null,"errorMessage":"fragments are not allowed: %q","messagePattern":"fragments are not allowed: %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/connhelper/ssh/ssh.go","lineNumber":67,"sourceCode":"\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()\n\tsp.Path = u.Path\n\tif u.RawQuery != \"\" {\n\t\treturn nil, fmt.Errorf(\"query parameters are not allowed: %q\", u.RawQuery)\n\t}\n\tif u.Fragment != \"\" {\n\t\treturn nil, fmt.Errorf(\"fragments are not allowed: %q\", u.Fragment)\n\t}\n\n\treturn &sp, nil\n}\n\n// Spec of SSH URL\ntype Spec struct {\n\tUser string\n\tHost string\n\tPort string\n\tPath string\n}\n\n// Args returns args except \"ssh\" itself combined with optional additional\n// command and args to be executed on the remote host. It attempts to quote\n// the given arguments to account for ssh executing the remote command in a\n// shell. It returns nil when unable to quote the remote command.\nfunc (sp *Spec) Args(remoteCommandAndArgs ...string) []string {","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/docker/cli/blob/4f84911bfe8811e9b028e4b1fee8e7510be79387/cli/connhelper/ssh/ssh.go#L49-L85","documentation":"Specific validation error from newSpec (ssh.go:66-67): the parsed ssh URL must not carry a URL fragment. If u.Fragment is non-empty, the fragment is echoed back and Spec construction aborts. Fragments have no meaning for an ssh connection target.","triggerScenarios":"ssh.ParseURL or NewSpec receives a URL like `ssh://user@host#section`. Any `#...` triggers the error.","commonSituations":"A URL is copy-pasted from documentation or a browser that appended a fragment (`#main`, `#docker`), or a user mistakenly adds a section anchor to DOCKER_HOST. Fragments are silently ignored by browsers but explicitly rejected here.","solutions":["Strip the `#...` fragment from the DOCKER_HOST ssh URL.","Re-paste the URL from a plain-text source without the trailing fragment.","Re-set DOCKER_HOST and retest."],"exampleFix":"# before\nexport DOCKER_HOST='ssh://user@host#docker'\n# after\nexport DOCKER_HOST='ssh://user@host'","handlingStrategy":"validation","validationCode":"u, _ := url.Parse(daemonURL)\nif u != nil && u.Fragment != \"\" {\n    return errors.New(\"ssh URL must not contain a fragment\")\n}","typeGuard":null,"tryCatchPattern":"spec, err := ssh.ParseURL(daemonURL)\nif err != nil {\n    return fmt.Errorf(\"ssh URL rejected: %w\", err)\n}","preventionTips":["Strip any trailing `#...` from pasted DOCKER_HOST values.","Paste URLs from plain text, not browser address bars.","Add a CI lint that rejects DOCKER_HOST values containing `#`."],"tags":["connhelper","ssh","url","fragment","validation"],"backgroundTag":null,"analyzedSha":"4f84911bfe8811e9b028e4b1fee8e7510be79387","analyzedAt":"2026-08-07T12:15:29.814Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}