{"record":{"id":"bbf484715e262975","repo":"wavetermdev/waveterm","slug":"cannot-parse-connection-name-w","errorCode":null,"errorMessage":"cannot parse connection name: %w","messagePattern":"cannot parse connection name: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/wsh/cmd/wshcmd-conn.go","lineNumber":83,"sourceCode":"\tRunE:    connEnsureRun,\n\tPreRunE: preRunSetupRpcClient,\n}\n\nfunc init() {\n\trootCmd.AddCommand(connCmd)\n\tconnCmd.AddCommand(connStatusCmd)\n\tconnCmd.AddCommand(connReinstallCmd)\n\tconnCmd.AddCommand(connDisconnectCmd)\n\tconnCmd.AddCommand(connDisconnectAllCmd)\n\tconnCmd.AddCommand(connConnectCmd)\n\tconnCmd.AddCommand(connEnsureCmd)\n}\n\nfunc validateConnectionName(name string) error {\n\tif !strings.HasPrefix(name, \"wsl://\") {\n\t\t_, err := remote.ParseOpts(name)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"cannot parse connection name: %w\", err)\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc getAllConnStatus() ([]wshrpc.ConnStatus, error) {\n\tvar allResp []wshrpc.ConnStatus\n\tsshResp, err := wshclient.ConnStatusCommand(RpcClient, nil)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"getting ssh connection status: %w\", err)\n\t}\n\tallResp = append(allResp, sshResp...)\n\twslResp, err := wshclient.WslStatusCommand(RpcClient, nil)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"getting wsl connection status: %w\", err)\n\t}\n\tallResp = append(allResp, wslResp...)\n\treturn allResp, nil","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/cmd/wsh/cmd/wshcmd-conn.go#L65-L101","documentation":"Error from validateConnectionName, used by `wsh conn connect|disconnect|ensure|reinstall`. For any name that is not a wsl:// URI, the code calls remote.ParseOpts to validate the connection name as a valid remote connection spec (e.g. user@host:port). If parsing fails, the name is not a recognized connection string and the underlying parse error is wrapped.","triggerScenarios":"Passing a malformed connection name to any of the conn subcommands: missing user/host, bad port syntax, unparseable SSH-style spec, or a typo in a saved connection name that no longer resolves.","commonSituations":"Typos like 'myhost:' or 'user@'; using a display/alias name where a connection spec is required; copying a name with stray whitespace or quotes; config entries for saved connections that were deleted.","solutions":["Fix the connection name syntax: use user@host[:port] (or wsl://... which bypasses parsing)","Check saved connection names (`wsh conn status` or ~/.ssh config) for the exact spelling","Trim whitespace and remove quotes from the argument","Ensure the remote name matches one registered in your connection config"],"exampleFix":"// before\nerr := validateConnectionName(\"myhost:\")\n// after\nerr := validateConnectionName(\"user@myhost:22\")","handlingStrategy":"validation","validationCode":"func validateConnName(name string) error {\n    if strings.HasPrefix(name, \"wsl://\") { return nil }\n    if name == \"\" || strings.ContainsAny(name, \" \\t\\\"\") { return fmt.Errorf(\"connection name has whitespace/quotes: %q\", name) }\n    if !strings.Contains(name, \"@\") && !strings.Contains(name, \":\") { return fmt.Errorf(\"expected user@host[:port], got %q\", name) }\n    return nil\n}","typeGuard":null,"tryCatchPattern":"if err := validateConnectionName(connName); err != nil {\n    var parseErr *remote.ParseOptsError\n    if errors.As(err, &parseErr) { /* fix syntax user@host[:port] */ }\n}","preventionTips":["Use the exact saved connection name from `wsh conn status`","Follow user@host[:port] syntax; use wsl:// prefix for WSL","Strip quotes/whitespace when interpolating names in shell scripts"],"tags":["cli","validation","ssh","connection"],"backgroundTag":"invalid-connection-string","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}