{"id":"2976f139e8f15c0c","repo":"docker/cli","slug":"invalid-port-w","errorCode":null,"errorMessage":"invalid port: %w","messagePattern":"invalid port: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/connhelper/ssh/ssh.go","lineNumber":120,"sourceCode":"\nfunc (sp *Spec) args(sshFlags ...string) ([]string, error) {\n\tvar args []string\n\tif sp.Host == \"\" {\n\t\treturn nil, errors.New(\"no host specified\")\n\t}\n\tif sp.User != \"\" {\n\t\t// Quote user, as it's obtained from the URL.\n\t\tusr, err := syntax.Quote(sp.User, syntax.LangPOSIX)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid user: %w\", err)\n\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","sourceCodeStart":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/cli/connhelper/ssh/ssh.go#L102-L138","documentation":"Error \"invalid port: %w\" thrown in docker/cli.","triggerScenarios":"Thrown at cli/connhelper/ssh/ssh.go:120 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}