{"record":{"id":"e504b94962b1497f","repo":"Hmbown/CodeWhale","slug":"secret-storage-operation-failed-failure-refu","errorCode":null,"errorMessage":"Secret storage {operation} failed: {failure}. Refusing to write the API key in plaintext to {}. Fix the configured secret backend and retry; Codewhale did not change that file.","messagePattern":"Secret storage (.+?) failed: (.+?)\\. Refusing to write the API key in plaintext to (.+?)\\. Fix the configured secret backend and retry; Codewhale did not change that file\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/config.rs","lineNumber":10380,"sourceCode":"            Err(error) => {\n                return Err(plaintext_credential_fallback_refused(\n                    \"snapshot\", &path, &error,\n                ));\n            }\n        }\n    }\n\n    let path = save_api_key_to_config_file(trimmed)?;\n    codewhale_config::scrub_plaintext_api_keys_from_config_backup(&path)?;\n    Ok(SavedCredential::ConfigFile(path))\n}\n\nfn plaintext_credential_fallback_refused(\n    operation: &str,\n    config_path: &Path,\n    failure: &dyn std::fmt::Display,\n) -> anyhow::Error {\n    anyhow::anyhow!(\n        \"Secret storage {operation} failed: {failure}. Refusing to write the API key in plaintext to {}. Fix the configured secret backend and retry; Codewhale did not change that file.\",\n        codewhale_config::quote_os_path(config_path)\n    )\n}\n\n/// The durable secret store for credential saves and logout-time deletes.\n///\n/// Under `cfg(test)` the store is only exposed when the test set both an\n/// isolated `CODEWHALE_HOME` and an explicit backend, so unit tests can never\n/// touch the developer's real credential store.\n#[cfg(not(test))]\nfn credential_secret_store() -> Option<codewhale_secrets::Secrets> {\n    Some(codewhale_secrets::Secrets::auto_detect())\n}\n\n#[cfg(test)]\nfn credential_secret_store() -> Option<codewhale_secrets::Secrets> {\n    let isolated_home = codewhale_paths::codewhale_home_is_explicit();","sourceCodeStart":10362,"sourceCodeEnd":10398,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/8880682c63083a91624de936797efa3ce9e498fd/crates/tui/src/config.rs#L10362-L10398","documentation":"Error \"Secret storage {operation} failed: {failure}. Refusing to write the API key in plaintext to {}. Fix the configured secret backend and retry; Codewhale did not change that file.\" thrown in Hmbown/CodeWhale.","triggerScenarios":"Thrown at crates/tui/src/config.rs:10380 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"8880682c63083a91624de936797efa3ce9e498fd","analyzedAt":"2026-08-16T11:31:27.956Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}