{"id":"05b76519580ea761","repo":"docker/cli","slug":"invalid-host-w","errorCode":null,"errorMessage":"invalid host: %w","messagePattern":"invalid host: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/connhelper/ssh/ssh.go","lineNumber":131,"sourceCode":"\t\t}\n\t\targs = append(args, \"-l\", usr)\n\t}\n\tif sp.Port != \"\" {\n\t\t// Quote port, as it's obtained from the URL.\n\t\tport, err := syntax.Quote(sp.Port, syntax.LangPOSIX)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid port: %w\", err)\n\t\t}\n\t\targs = append(args, \"-p\", port)\n\t}\n\n\t// We consider \"sshFlags\" to be \"trusted\", and set from code only,\n\t// as they are not parsed from the DOCKER_HOST URL.\n\targs = append(args, sshFlags...)\n\n\thost, err := syntax.Quote(sp.Host, syntax.LangPOSIX)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"invalid host: %w\", err)\n\t}\n\n\treturn append(args, \"--\", host), nil\n}\n\n// Command returns the ssh flags and arguments to execute a command\n// (remoteCommandAndArgs) on the remote host. Where needed, it quotes\n// values passed in remoteCommandAndArgs to account for ssh executing\n// the remote command in a shell. It returns an error if no remote command\n// is passed, or when unable to quote the remote command.\n//\n// Important: to preserve backward-compatibility, Command does not currently\n// perform sanitization or quoting on the sshFlags and callers are expected\n// to sanitize this argument.\nfunc (sp *Spec) Command(sshFlags []string, remoteCommandAndArgs ...string) ([]string, error) {\n\tif len(remoteCommandAndArgs) == 0 {\n\t\treturn nil, errors.New(\"no remote command specified\")\n\t}","sourceCodeStart":113,"sourceCodeEnd":149,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/cli/connhelper/ssh/ssh.go#L113-L149","documentation":"Error \"invalid host: %w\" thrown in docker/cli.","triggerScenarios":"Thrown at cli/connhelper/ssh/ssh.go:131 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"e9452d6e785f6e365712b9d71bd7517591773c86","analyzedAt":"2026-08-01T07:09:22.474Z","schemaVersion":2}