{"record":{"id":"cf3dd71e8a5a5809","repo":"tinyhumansai/openhuman","slug":"keychain-payload-for-profile-profile-id-is-not-v","errorCode":null,"errorMessage":"Keychain payload for profile {profile_id} is not valid JSON: {e}","messagePattern":"Keychain payload for profile (.+?) is not valid JSON: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/openhuman/security/credentials/profiles.rs","lineNumber":363,"sourceCode":"            Ok(Some(p)) => p,\n            Ok(None) => {\n                log::debug!(\n                    \"[auth] keychain_load_secrets miss profile_id={profile_id} user_id={}\",\n                    self.user_id\n                );\n                return Ok(None);\n            }\n            Err(e) => {\n                log::warn!(\n                    \"[auth] keychain_load_secrets error profile_id={profile_id} user_id={}: {e} | detail={}\",\n                    self.user_id,\n                    e.diagnostic()\n                );\n                return Ok(None);\n            }\n        };\n        let secrets: KeychainSecrets = serde_json::from_str(&payload).map_err(|e| {\n            anyhow::anyhow!(\"Keychain payload for profile {profile_id} is not valid JSON: {e}\")\n        })?;\n        log::debug!(\n            \"[auth] keychain_load_secrets hit profile_id={profile_id} user_id={}\",\n            self.user_id\n        );\n        Ok(Some(secrets))\n    }\n\n    /// Delete keychain secrets for a profile (called on profile removal).\n    fn keychain_delete_secrets(&self, profile_id: &str) {\n        let key = self.keychain_key_for_profile(profile_id);\n        if let Err(e) = crate::openhuman::security::keyring::delete(&self.user_id, &key) {\n            log::warn!(\n                \"[auth] keychain_delete_secrets error profile_id={profile_id} user_id={}: {e} | detail={}\",\n                self.user_id,\n                e.diagnostic()\n            );\n        } else {","sourceCodeStart":345,"sourceCodeEnd":381,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/749120085864ce16e0f273c7b86fac7740b39c5b/src/openhuman/security/credentials/profiles.rs#L345-L381","documentation":"The keychain entry for a profile was retrieved successfully but its payload is not the compact JSON secret object the writer stored — serde failed to parse it. This indicates corruption or an external/manual edit of the keychain entry. Notably the surrounding load path returns Ok(None) on keychain errors, so this parse failure is on otherwise-valid retrieved bytes.","triggerScenarios":"Thrown at src/openhuman/security/credentials/profiles.rs:363 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Re-authenticate the profile to rewrite a fresh keychain payload","Inspect the parse error `{e}` for the malformed field","Remove the corrupted keychain entry and re-store credentials"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"749120085864ce16e0f273c7b86fac7740b39c5b","analyzedAt":"2026-08-17T21:21:45.363Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}