{"record":{"id":"0b387d07d4051549","repo":"wavetermdev/waveterm","slug":"checking-secret-storage-backend-w","errorCode":null,"errorMessage":"checking secret storage backend: %w","messagePattern":"checking secret storage backend: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/wsh/cmd/wshcmd-secret.go","lineNumber":121,"sourceCode":"\tdefer func() {\n\t\tsendActivity(\"secret\", rtnErr == nil)\n\t}()\n\n\tparts := strings.SplitN(args[0], \"=\", 2)\n\tif len(parts) != 2 {\n\t\treturn fmt.Errorf(\"invalid format: expected [name]=[value]\")\n\t}\n\n\tname := parts[0]\n\tvalue := parts[1]\n\n\tif name == \"\" {\n\t\treturn fmt.Errorf(\"secret name cannot be empty\")\n\t}\n\n\tbackend, err := wshclient.GetSecretsLinuxStorageBackendCommand(RpcClient, &wshrpc.RpcOpts{Timeout: 2000})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"checking secret storage backend: %w\", err)\n\t}\n\n\tif backend == \"basic_text\" || backend == \"unknown\" {\n\t\treturn fmt.Errorf(\"No appropriate secret manager found, cannot set secrets\")\n\t}\n\n\tsecrets := map[string]*string{name: &value}\n\terr = wshclient.SetSecretsCommand(RpcClient, secrets, &wshrpc.RpcOpts{Timeout: 2000})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"setting secret: %w\", err)\n\t}\n\n\tWriteStdout(\"secret set: %s\\n\", name)\n\treturn nil\n}\n\nfunc secretListRun(cmd *cobra.Command, args []string) (rtnErr error) {\n\tdefer func() {","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/cmd/wsh/cmd/wshcmd-secret.go#L103-L139","documentation":"This wraps any failure of the GetSecretsLinuxStorageBackendCommand RPC, which asks the daemon which secret storage backend Linux is using. The command checks the backend before setting a secret so it can refuse early if storage is inadequate; if this pre-check RPC itself fails (unreachable daemon, timeout, or handler error), the whole set operation aborts with this wrapped error.","triggerScenarios":"Running `wsh secret set NAME=VALUE` on Linux when the daemon is unreachable or times out (2000ms RpcOpts timeout), or the server-side backend-detection handler errors (e.g. failure probing gnome-keyring/kwallet/secret-service via D-Bus).","commonSituations":"Linux headless servers or WSL without a keyring service running (no D-Bus / secret-service), so backend probing fails; stale wsh connection after Wave restart; daemon busy on a hung keyring call causing the timeout.","solutions":["Ensure the Wave daemon is running and reachable (retry from a Wave terminal; restart Wave if the connection is stale).","On Linux, verify a secret service is available: check `busctl --user` / that gnome-keyring or KWallet is running; install/run one if on a headless box.","If the wrapped error is a timeout, look for a hung keyring/D-Bus daemon blocking the backend probe and restart it.","Update Wave Terminal and wsh to matching versions so the backend RPC exists on both ends."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Pre-check reachability before set:\n// if err := exec.Command(\"wsh\", \"ls\").Run(); err != nil { /* fix daemon connection first */ }","typeGuard":null,"tryCatchPattern":"backend, err := wshclient.GetSecretsLinuxStorageBackendCommand(RpcClient, &wshrpc.RpcOpts{Timeout: 2000})\nif err != nil {\n    if errors.Is(err, ErrTimeout) {\n        // daemon hung or unreachable; restart Wave and check keyring service\n    }\n    return fmt.Errorf(\"checking secret storage backend: %w\", err)\n}","preventionTips":["Verify a secret service (gnome-keyring/KWallet) is running before scripted sets on Linux","Check D-Bus availability in headless/WSL/CI environments","Keep Wave and wsh at matching versions","Restart Wave to refresh stale RPC connections"],"tags":["rpc","linux","keyring","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"}