{"record":{"id":"0660d7fe5ed62c23","repo":"wavetermdev/waveterm","slug":"getting-secret-w","errorCode":null,"errorMessage":"getting secret: %w","messagePattern":"getting secret: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/wsh/cmd/wshcmd-secret.go","lineNumber":90,"sourceCode":"\tsecretCmd.AddCommand(secretSetCmd)\n\tsecretCmd.AddCommand(secretListCmd)\n\tsecretCmd.AddCommand(secretDeleteCmd)\n\tsecretCmd.AddCommand(secretUiCmd)\n}\n\nfunc secretGetRun(cmd *cobra.Command, args []string) (rtnErr error) {\n\tdefer func() {\n\t\tsendActivity(\"secret\", rtnErr == nil)\n\t}()\n\n\tname := args[0]\n\tif !secretNameRegex.MatchString(name) {\n\t\treturn fmt.Errorf(\"invalid secret name: must start with a letter and contain only letters, numbers, and underscores\")\n\t}\n\n\tresp, err := wshclient.GetSecretsCommand(RpcClient, []string{name}, &wshrpc.RpcOpts{Timeout: 2000})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"getting secret: %w\", err)\n\t}\n\n\tvalue, ok := resp[name]\n\tif !ok {\n\t\treturn fmt.Errorf(\"secret not found: %s\", name)\n\t}\n\n\tWriteStdout(\"%s\\n\", value)\n\treturn nil\n}\n\nfunc secretSetRun(cmd *cobra.Command, args []string) (rtnErr error) {\n\tdefer func() {\n\t\tsendActivity(\"secret\", rtnErr == nil)\n\t}()\n\n\tparts := strings.SplitN(args[0], \"=\", 2)\n\tif len(parts) != 2 {","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/cmd/wsh/cmd/wshcmd-secret.go#L72-L108","documentation":"This error wraps any failure of the GetSecretsCommand RPC (2s timeout) issued by `wsh secret get`. It means the wsh client could not retrieve secrets from the Wave daemon — the request itself failed, as opposed to the secret simply not existing (which yields \"secret not found\"). Typical wrapped causes are the daemon not running/not connected, the route being unavailable, or the RPC timing out.","triggerScenarios":"Running `wsh secret get NAME` when no Wave Terminal daemon is reachable (Wave not running, stale connection), when the wshclient call exceeds the 2000ms RpcOpts timeout, or when the server-side GetSecrets handler returns an error (e.g. secret store access failure on Linux keyring issues).","commonSituations":"Running wsh from a plain SSH shell where the Wave daemon is not running; Wave app was restarted and the CLI connection is stale; slow system keyring (gnome-keyring/kwallet) blocking the daemon causing the 2s timeout; older wsh binary talking to a newer daemon without the secrets RPC.","solutions":["Ensure Wave Terminal (and its daemon) is running and reconnect: rerun the command from a Wave terminal or restart Wave.","Retry after checking general wsh connectivity (e.g. `wsh ls`); if it times out, investigate the wrapped error for timeout vs route-not-found.","If the wrapped error is a timeout, check for a hung secret manager (gnome-keyring, kwallet) on Linux that blocks the daemon's secret store.","Update both Wave Terminal and wsh to matching versions so the GetSecrets RPC exists on both sides."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Check wsh/daemon connectivity first:\n// err := exec.Command(\"wsh\", \"ls\").Run(); if err != nil { /* daemon unreachable */ }","typeGuard":null,"tryCatchPattern":"if err := secretGet(name); err != nil {\n    var rpcErr *RPCError\n    if errors.As(err, &rpcErr) && errors.Is(rpcErr, ErrTimeout) {\n        // daemon slow or unreachable; check Wave is running, then retry once\n    } else {\n        return fmt.Errorf(\"getting secret: %w\", err)\n    }\n}","preventionTips":["Run wsh secret commands from an environment where the Wave daemon is running","Increase the RpcOpts timeout for slow keyring backends","Retry once on transient RPC failures before surfacing the error","Keep Wave Terminal and wsh versions in sync"],"tags":["rpc","network","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"}