{"record":{"id":"9637268db7dd03d5","repo":"wavetermdev/waveterm","slug":"disconnecting-q-error-w","errorCode":null,"errorMessage":"disconnecting %q error: %w","messagePattern":"disconnecting %q error: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/wsh/cmd/wshcmd-conn.go","lineNumber":155,"sourceCode":"\t\tConnName:   connName,\n\t\tLogBlockId: RpcContext.BlockId,\n\t}\n\terr := wshclient.ConnReinstallWshCommand(RpcClient, data, &wshrpc.RpcOpts{Timeout: 60000})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"reinstalling connection: %w\", err)\n\t}\n\tWriteStdout(\"wsh reinstalled on connection %q\\n\", connName)\n\treturn nil\n}\n\nfunc connDisconnectRun(cmd *cobra.Command, args []string) error {\n\tconnName := args[0]\n\tif err := validateConnectionName(connName); err != nil {\n\t\treturn err\n\t}\n\terr := wshclient.ConnDisconnectCommand(RpcClient, connName, &wshrpc.RpcOpts{Timeout: 10000})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"disconnecting %q error: %w\", connName, err)\n\t}\n\tWriteStdout(\"disconnected %q\\n\", connName)\n\treturn nil\n}\n\nfunc connDisconnectAllRun(cmd *cobra.Command, args []string) error {\n\tallConns, err := getAllConnStatus()\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, conn := range allConns {\n\t\tif conn.Status != \"connected\" {\n\t\t\tcontinue\n\t\t}\n\t\terr := wshclient.ConnDisconnectCommand(RpcClient, conn.Connection, &wshrpc.RpcOpts{Timeout: 10000})\n\t\tif err != nil {\n\t\t\tWriteStdout(\"error disconnecting %q: %v\\n\", conn.Connection, err)\n\t\t} else {","sourceCodeStart":137,"sourceCodeEnd":173,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/cmd/wsh/cmd/wshcmd-conn.go#L137-L173","documentation":"Returned by connDisconnectRun when the ConnDisconnectCommand RPC fails for the given connection name (10-second timeout). The wrapper identifies the connection with %q and wraps the underlying error. The disconnect itself did not complete on the server.","triggerScenarios":"Running `wsh conn disconnect <conn>` when the RPC errors: connection does not exist server-side, timeout exceeded (10s), or the server rejects the disconnect request.","commonSituations":"Disconnecting an already-closed connection, typos in the connection name, slow/unresponsive server exceeding the 10s timeout.","solutions":["Verify the connection name with `wsh conn status`; correct any typo","Retry once — transient RPC timeouts are common; if persistent, the server may be overloaded","Check whether the connection is actually already disconnected (the goal may already be met)","Inspect the wrapped inner error for the server-side root cause"],"exampleFix":"// before\nwsh conn disconnect prod\ncould not disconnect\n// after\nwsh conn status   # confirm exact name\nwsh conn disconnect myserver","handlingStrategy":"retry","validationCode":"status, err := wshclient.ConnStatusCommand(RpcClient, nil)\nif err == nil && !slices.ContainsFunc(status, func(c wshrpc.ConnStatusEntry) bool { return c.ConnName == connName && c.Connected }) {\n    return nil // already disconnected, nothing to do\n}","typeGuard":null,"tryCatchPattern":"err := wshclient.ConnDisconnectCommand(RpcClient, connName, &wshrpc.RpcOpts{Timeout: 10000})\nif err != nil {\n    if errors.Is(err, context.DeadlineExceeded) {\n        // one retry, then surface\n    }\n    return fmt.Errorf(\"disconnecting %q error: %w\", connName, err)\n}","preventionTips":["Validate the connection name via `wsh conn status` before disconnecting","Treat 'already disconnected' outcomes as success in scripts (idempotency)","Retry once on timeout; the 10s budget is tight under load","Quote names exactly — typos are the most common cause"],"tags":["cli","rpc","disconnect","timeout"],"backgroundTag":"rpc-call-failed","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}