{"record":{"id":"2e622efab86f1d93","repo":"wavetermdev/waveterm","slug":"error-getting-secret-names-w","errorCode":null,"errorMessage":"error getting secret names: %w","messagePattern":"error getting secret names: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/wshrpc/wshserver/wshserver.go","lineNumber":1492,"sourceCode":"\nfunc (ws *WshServer) GetSecretsCommand(ctx context.Context, names []string) (map[string]string, error) {\n\tresult := make(map[string]string)\n\tfor _, name := range names {\n\t\tvalue, exists, err := secretstore.GetSecret(name)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error getting secret %q: %w\", name, err)\n\t\t}\n\t\tif exists {\n\t\t\tresult[name] = value\n\t\t}\n\t}\n\treturn result, nil\n}\n\nfunc (ws *WshServer) GetSecretsNamesCommand(ctx context.Context) ([]string, error) {\n\tnames, err := secretstore.GetSecretNames()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error getting secret names: %w\", err)\n\t}\n\treturn names, nil\n}\n\nfunc (ws *WshServer) SetSecretsCommand(ctx context.Context, secrets map[string]*string) error {\n\tfor name, value := range secrets {\n\t\tif value == nil {\n\t\t\terr := secretstore.DeleteSecret(name)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"error deleting secret %q: %w\", name, err)\n\t\t\t}\n\t\t} else {\n\t\t\terr := secretstore.SetSecret(name, *value)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"error setting secret %q: %w\", name, err)\n\t\t\t}\n\t\t}\n\t}","sourceCodeStart":1474,"sourceCodeEnd":1510,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/pkg/wshrpc/wshserver/wshserver.go#L1474-L1510","documentation":"GetSecretsNamesCommand enumerates all stored secret names via secretstore.GetSecretNames. Enumerating requires access to every entry in the secret backend, so any backend-level failure is wrapped as \"error getting secret names\". This lists names only — values are never returned.","triggerScenarios":"Calling GetSecretsNamesCommand when the OS secret backend cannot enumerate its collection: locked/unavailable keychain, missing Linux secret backend, or corrupt backend storage.","commonSituations":"Headless Linux without gnome-keyring/KWallet; macOS Keychain locked; switching Linux storage backends without migration leaving an unreadable collection.","solutions":["Check the wrapped cause for which backend failed.","On Linux, verify a secret service is available or set a valid storage backend (see GetSecretsLinuxStorageBackendCommand).","Unlock the keychain / start the keyring daemon and retry."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if runtime.GOOS == \"linux\" {\n    if _, err := wshclient.GetSecretsLinuxStorageBackendCommand(ctx); err != nil {\n        return fmt.Errorf(\"cannot enumerate secrets, no backend: %w\", err)\n    }\n}","typeGuard":null,"tryCatchPattern":"names, err := wshclient.GetSecretsNamesCommand(ctx)\nif err != nil && strings.Contains(err.Error(), \"error getting secret names\") {\n    // unlock keychain / start secret service, then retry\n}","preventionTips":["Run enumeration only in sessions with a live keyring (D-Bus on Linux, unlocked Keychain on macOS).","Cache the name list rather than re-enumerating frequently.","Install a secrets provider on minimal Linux systems before using wsh secrets."],"tags":["secrets","keychain","rpc"],"backgroundTag":"keychain-unavailable","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}