{"record":{"id":"8df1a8813647e08d","repo":"wavetermdev/waveterm","slug":"connecting-connection-w","errorCode":null,"errorMessage":"connecting connection: %w","messagePattern":"connecting connection: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/wsh/cmd/wshcmd-conn.go","lineNumber":191,"sourceCode":"\t\t} else {\n\t\t\tWriteStdout(\"disconnected %q\\n\", conn.Connection)\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc connConnectRun(cmd *cobra.Command, args []string) error {\n\tconnName := args[0]\n\tif err := validateConnectionName(connName); err != nil {\n\t\treturn err\n\t}\n\tdata := wshrpc.ConnRequest{\n\t\tHost:       connName,\n\t\tLogBlockId: RpcContext.BlockId,\n\t}\n\terr := wshclient.ConnConnectCommand(RpcClient, data, &wshrpc.RpcOpts{Timeout: 60000})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"connecting connection: %w\", err)\n\t}\n\tWriteStdout(\"connected connection %q\\n\", connName)\n\treturn nil\n}\n\nfunc connEnsureRun(cmd *cobra.Command, args []string) error {\n\tconnName := args[0]\n\tif err := validateConnectionName(connName); err != nil {\n\t\treturn err\n\t}\n\tdata := wshrpc.ConnExtData{\n\t\tConnName:   connName,\n\t\tLogBlockId: RpcContext.BlockId,\n\t}\n\terr := wshclient.ConnEnsureCommand(RpcClient, data, &wshrpc.RpcOpts{Timeout: 60000})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"ensuring connection: %w\", err)\n\t}","sourceCodeStart":173,"sourceCodeEnd":209,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/cmd/wsh/cmd/wshcmd-conn.go#L173-L209","documentation":"Returned by connConnectRun when the ConnConnectCommand RPC fails (60-second timeout). It means the server could not establish the requested connection to the host. The underlying error is preserved via %w.","triggerScenarios":"Running `wsh conn connect <conn>` when the host is unreachable, SSH/WSL authentication fails, the RPC times out at 60s, or the server rejects the ConnRequest.","commonSituations":"Wrong hostname in the connection config, expired SSH keys/passwords, remote host offline, firewall blocking the port, DNS failures.","solutions":["Test raw connectivity to the host (ping/ssh) to separate network from wsh issues","Verify SSH credentials/keys for the connection are valid and not expired","Retry — 60s can be exceeded on slow links; check the wrapped error for 'timeout'","Confirm the connection name/config is correct via `wsh conn status` or config files"],"exampleFix":"// before\nwsh conn connect badhost\n// error: connecting connection: dial tcp: lookup badhost: no such host\n// after\nssh badhost   # verify reachability first, fix ~/.ssh/config, then\nwsh conn connect badhost","handlingStrategy":"validation","validationCode":"if err := validateConnectionName(connName); err != nil {\n    return err\n}\n// pre-check raw reachability before consuming the 60s RPC budget\nif host != \"\" && isSshStyleHost(host) {\n    if err := probeSshReachability(host); err != nil {\n        return fmt.Errorf(\"host %q unreachable, fix connectivity before connecting: %w\", host, err)\n    }\n}","typeGuard":null,"tryCatchPattern":"err := wshclient.ConnConnectCommand(RpcClient, data, &wshrpc.RpcOpts{Timeout: 60000})\nif err != nil {\n    if errors.Is(err, context.DeadlineExceeded) {\n        return fmt.Errorf(\"connecting connection: timed out after 60s; check host reachability\")\n    }\n    return fmt.Errorf(\"connecting connection: %w\", err)\n}","preventionTips":["Verify SSH keys/passwords are current before connecting","Test `ssh <host>` manually to separate network vs wsh problems","Watch the 60s timeout on high-latency links","Keep connection configs (hostnames, users, ports) accurate and reviewed"],"tags":["cli","rpc","ssh","connection"],"backgroundTag":"connection-refused","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}