{"record":{"id":"489b2b21db7b5145","repo":"Hmbown/CodeWhale","slug":"refusing-to-replace-xai-oauth-generation","errorCode":null,"errorMessage":"refusing to replace xAI OAuth generation","messagePattern":"refusing to replace xAI OAuth generation","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/config/src/xai_credentials.rs","lineNumber":1522,"sourceCode":"        match File::open(self.directory.join(name)) {\n            Ok(file) => Ok(Some(file)),\n            Err(error) if error.kind() == std::io::ErrorKind::NotFound => Ok(None),\n            Err(error) => Err(error.into()),\n        }\n    }\n\n    fn open_internal_file(&self, name: &str) -> Result<File> {\n        validate_private_basename(name)?;\n        Ok(fs::OpenOptions::new()\n            .read(true)\n            .write(true)\n            .create(true)\n            .open(self.directory.join(name))?)\n    }\n\n    fn write_owned_file(&self, name: &str, bytes: &[u8], allow_replace: bool) -> Result<()> {\n        let path = self.directory.join(name);\n        anyhow::ensure!(\n            allow_replace || !path.exists(),\n            \"refusing to replace xAI OAuth generation\"\n        );\n        crate::persistence::atomic_write(&path, bytes)\n    }\n\n    fn remove_raw(&self, name: &str) -> Result<bool> {\n        validate_private_basename(name)?;\n        match fs::remove_file(self.directory.join(name)) {\n            Ok(()) => Ok(true),\n            Err(error) if error.kind() == std::io::ErrorKind::NotFound => Ok(false),\n            Err(error) => Err(error.into()),\n        }\n    }\n\n    fn rename_raw(&self, from: &str, to: &str) -> Result<()> {\n        validate_private_basename(from)?;\n        validate_private_basename(to)?;","sourceCodeStart":1504,"sourceCodeEnd":1540,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/8880682c63083a91624de936797efa3ce9e498fd/crates/config/src/xai_credentials.rs#L1504-L1540","documentation":"Error \"refusing to replace xAI OAuth generation\" thrown in Hmbown/CodeWhale.","triggerScenarios":"Thrown at crates/config/src/xai_credentials.rs:1522 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"}