{"record":{"id":"19906624c9a344c2","repo":"Hmbown/CodeWhale","slug":"failed-to-delete-stored-credentials-for","errorCode":null,"errorMessage":"failed to delete stored credentials for: {}","messagePattern":"failed to delete stored credentials for: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/config.rs","lineNumber":13312,"sourceCode":"            \"credential.clear\",\n            json!({\n                \"backend\": \"config_file\",\n                \"config_path\": config_path.display().to_string(),\n                \"scope\": \"root_and_provider_keys\",\n            }),\n        );\n    }\n\n    // The config scrub alone leaves the durable secret-store credential\n    // alive, and the read chain prefers the secret store over the file, so a\n    // \"cleared\" key silently came back on the next launch (#5196). Delete\n    // every provider slot too, symmetric with CLI logout (#5159). This runs\n    // even when the config file is absent: the slot survives independently\n    // of the file.\n    if let Some(secrets) = credential_secret_store() {\n        let failures = clear_all_provider_api_keys_from_secret_store(secrets);\n        if !failures.is_empty() {\n            anyhow::bail!(\n                \"failed to delete stored credentials for: {}\",\n                failures.join(\", \")\n            );\n        }\n    }\n\n    Ok(())\n}\n\n/// Delete the credential slot of every provider that has one stored.\n///\n/// Mirrors the CLI logout helper (#5159): each slot is probed first so\n/// backends that error on deleting a missing item stay quiet, slots shared\n/// by several providers (e.g. the historical `siliconflow` slot) are deleted\n/// once, and every deletion failure is returned as a human-readable entry so\n/// the caller can fail loudly instead of claiming a clean logout while\n/// credentials linger in the store (#5196).\nfn clear_all_provider_api_keys_from_secret_store(","sourceCodeStart":13294,"sourceCodeEnd":13330,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/config.rs#L13294-L13330","documentation":"During full logout, Codewhale clears every provider API-key slot from the OS secret store, symmetric with CLI logout. If any slot fails to delete, the logout aborts and the error lists the providers whose stored credentials could not be removed — because leaving credentials behind is a security concern, it fails loud.","triggerScenarios":"Calling the logout/clear-all routine when `clear_all_provider_api_keys_from_secret_store` returns failures (secret service unavailable, keychain denied access, individual entry deletion errors).","commonSituations":"macOS Keychain denying access from an unsigned/rebuilt binary; Linux with no secret-service daemon (gnome-keyring not running); stale keyring entries locked behind a session.","solutions":["Retry logout after ensuring the OS secret service is running and unlocked (e.g. start gnome-keyring, unlock the Keychain)","Delete the listed entries manually via your secret-service tool, then retry","Run logout in an environment where the same user session owns the keychain that stored the keys"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// ensure the secret service is reachable before logout\ncredential_secret_store().ok_or(\"OS secret store unavailable; unlock keychain first\")?;","typeGuard":null,"tryCatchPattern":"match logout_result {\n    Err(e) if e.to_string().starts_with(\"failed to delete stored credentials\") => {\n        eprintln!(\"unlock/restart the secret service, then retry logout: {e}\");\n    }\n    other => other?,\n}","preventionTips":["Run logout in the same user session that stored the credentials","Ensure gnome-keyring/Keychain is running and unlocked","Manually verify no provider slots remain after a failed logout"],"tags":["secrets","keychain","logout","security"],"backgroundTag":"file-delete-failed","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}