tinyhumansai/openhuman · error · anyhow::Error
Keychain payload for profile {profile_id} is not valid JSON:
Error message
Keychain payload for profile {profile_id} is not valid JSON: {e} What it means
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.
Source
Thrown at src/openhuman/security/credentials/profiles.rs:363
Ok(Some(p)) => p,
Ok(None) => {
log::debug!(
"[auth] keychain_load_secrets miss profile_id={profile_id} user_id={}",
self.user_id
);
return Ok(None);
}
Err(e) => {
log::warn!(
"[auth] keychain_load_secrets error profile_id={profile_id} user_id={}: {e} | detail={}",
self.user_id,
e.diagnostic()
);
return Ok(None);
}
};
let secrets: KeychainSecrets = serde_json::from_str(&payload).map_err(|e| {
anyhow::anyhow!("Keychain payload for profile {profile_id} is not valid JSON: {e}")
})?;
log::debug!(
"[auth] keychain_load_secrets hit profile_id={profile_id} user_id={}",
self.user_id
);
Ok(Some(secrets))
}
/// Delete keychain secrets for a profile (called on profile removal).
fn keychain_delete_secrets(&self, profile_id: &str) {
let key = self.keychain_key_for_profile(profile_id);
if let Err(e) = crate::openhuman::security::keyring::delete(&self.user_id, &key) {
log::warn!(
"[auth] keychain_delete_secrets error profile_id={profile_id} user_id={}: {e} | detail={}",
self.user_id,
e.diagnostic()
);
} else {View on GitHub (pinned to 7491200858)
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
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at src/openhuman/security/credentials/profiles.rs:363 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of tinyhumansai/openhuman@7491200858 (2026-08-17).
Data as JSON: /api/errors/cf3dd71e8a5a5809.
Report an issue: GitHub.