{"record":{"id":"1c5539ad46f36ac0","repo":"wavetermdev/waveterm","slug":"secret-not-found-s","errorCode":null,"errorMessage":"secret not found: %s","messagePattern":"secret not found: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/wsh/cmd/wshcmd-secret.go","lineNumber":95,"sourceCode":"\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 {\n\t\treturn fmt.Errorf(\"invalid format: expected [name]=[value]\")\n\t}\n\n\tname := parts[0]\n\tvalue := parts[1]","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/cmd/wsh/cmd/wshcmd-secret.go#L77-L113","documentation":"After a successful GetSecretsCommand RPC, the command looks up the requested name in the returned map; if the key is absent it reports the secret does not exist. This is a normal not-found condition, not an RPC failure — the daemon responded but has no secret stored under that name.","triggerScenarios":"Running `wsh secret get NAME` where NAME passes the name regex and the RPC succeeds, but no secret was ever set under NAME (or it was deleted), e.g. `wsh secret get db_password` when only `dbPassword` exists.","commonSituations":"Typo'd or case-mismatched names (Secrets are case-sensitive); secrets set on a different machine/profile than the one queried; secret deleted via the Wave secrets UI; fresh environment where setup scripts never ran.","solutions":["Run `wsh secret list` to see the exact stored names and correct the spelling/case.","Set the secret first with `wsh secret set NAME=VALUE`, then get it.","If you expect the secret from another machine, remember the secret store is per-machine (keyring-backed); set it locally or sync it explicitly.","If the name was set via wconfig secrets files, verify the file was loaded by the daemon and the name matches the store's naming rules."],"exampleFix":"// before\nvalue=$(wsh secret get DB_PASS)\n// after\nwsh secret list   # confirm exact name\nvalue=$(wsh secret get DB_PASSWORD)","handlingStrategy":"validation","validationCode":"names, _ := wshclient.GetSecretsNamesCommand(RpcClient, &wshrpc.RpcOpts{Timeout: 2000})\nif !slices.Contains(names, name) {\n    return fmt.Errorf(\"secret %q does not exist; available: %v\", name, names)\n}","typeGuard":"func secretExists(resp map[string]string, name string) bool {\n    _, ok := resp[name]\n    return ok\n}","tryCatchPattern":"value, ok := resp[name]\nif !ok {\n    return fmt.Errorf(\"secret not found: %s (run 'wsh secret list' to see stored names)\", name)\n}","preventionTips":["List secrets before getting to verify exact spelling and casing","Treat names as case-sensitive; standardize on a naming convention","Remember the store is per-machine — set secrets on the machine where you read them","Handle not-found explicitly in scripts instead of assuming the secret exists"],"tags":["not-found","cli","secrets"],"backgroundTag":"secret-not-found","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}