{"record":{"id":"353d5e9989d98a54","repo":"kopia/kopia","slug":"unable-to-persist-password-353d5e","errorCode":null,"errorMessage":"unable to persist password","messagePattern":"unable to persist password","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"internal/passwordpersist/passwordpersist.go","lineNumber":43,"sourceCode":"\t// PersistPassword persists a password, returns ErrUnsupported or fatal errors.\n\tPersistPassword(ctx context.Context, configFile, password string) error\n\n\t// DeletePassword deletes any persisted password, returns fatal errors.\n\tDeletePassword(ctx context.Context, configFile string) error\n}\n\n// OnSuccess is a helper that persists the given (configFile,password) if the provided err is nil\n// and deletes any persisted password otherwise.\nfunc OnSuccess(ctx context.Context, err error, s Strategy, configFile, password string) error {\n\tif err != nil {\n\t\tif err2 := s.DeletePassword(ctx, configFile); err2 != nil {\n\t\t\tlog(ctx).Infof(\"unable to delete persistent password: %v\", err2)\n\t\t}\n\n\t\treturn err\n\t}\n\n\treturn errors.Wrap(s.PersistPassword(ctx, configFile, password), \"unable to persist password\")\n}\n","sourceCodeStart":25,"sourceCodeEnd":45,"githubUrl":"https://github.com/kopia/kopia/blob/82495e54b584c1ef6073c9e1be048f57f8aef078/internal/passwordpersist/passwordpersist.go#L25-L45","documentation":"OnSuccess persistently saves the connected server's password after a successful connect. This error wraps a failure of s.PersistPassword (keyring or file strategy), meaning the password could not be stored for future passwordless reconnects — the connect itself succeeded.","triggerScenarios":"Calling OnSuccess (directly or via connect commands) when the chosen PasswordStorage's PersistPassword fails: OS keyring locked/unavailable, file write denied, or an unsupported platform strategy.","commonSituations":"macOS/Linux keyring locked or no keyring daemon running; read-only or unwritable config directory; disk full; headless CI without a keyring service.","solutions":["Unlock or initialize the OS keyring (e.g. unlock gnome-keyring/login keychain) and retry the connect","Check write permissions on the directory containing the config file","Select a different persistence strategy (e.g. file-based) via the passwordpersist options if keyring is unavailable","Persist nothing and provide the password at each connect as a fallback"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// check whether the keyring is usable before attempting persistence\nif _, err := keyring.Get(service, \"probe\"); err != nil && !errors.Is(err, keyring.ErrNotFound) {\n\tlog.Printf(\"keyring unavailable, password will not persist: %v\", err)\n}","typeGuard":"null","tryCatchPattern":null,"preventionTips":["Ensure a running, unlocked keyring daemon before connecting","Keep the config directory writable by the running user","Allow users to opt into non-persistent passwords on headless systems"],"tags":["keyring","password-persistence","storage"],"backgroundTag":"file-write-failed","analyzedSha":"82495e54b584c1ef6073c9e1be048f57f8aef078","analyzedAt":"2026-09-07T20:35:21.689Z","contentChangedAt":"2026-09-07T20:35:21.689Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}