tinyhumansai/openhuman · error · anyhow::Error
AES-GCM decrypt failed
Error message
AES-GCM decrypt failed: {e} What it means
AEAD decryption failure in decrypt_handoff_blob: the AES-256-GCM open() on the reassembled nonce+ciphertext+tag failed. GCM failure means authentication, not I/O: the tag did not verify — wrong key, corrupted/truncated blob, or a tampered payload. The original aes-gcm error is wrapped with this message and the handoff token fetch aborts.
Solutions
- Confirm the key matches the one that encrypted the handoff blob (same pairing/session)
- Re-request the handoff blob — truncation in transit produces the same tag failure
- Treat persistent failures across fresh blobs as a key-derivation mismatch: re-pair rather than retrying blindly
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at src/api/rest.rs:1162 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/7b9cb9624bf6ae35.
Report an issue: GitHub.
Appendix: source
Thrown at src/api/rest.rs:1162
let ciphertext = &combined[32..];
// aes-gcm expects ciphertext || tag
let mut ct_with_tag = Vec::with_capacity(ciphertext.len() + tag.len());
ct_with_tag.extend_from_slice(ciphertext);
ct_with_tag.extend_from_slice(tag);
use aes_gcm::aead::generic_array::typenum::U16;
use aes_gcm::aead::{Aead, KeyInit};
use aes_gcm::aes::Aes256;
use aes_gcm::AesGcm;
type Aes256Gcm16 = AesGcm<Aes256, U16>;
let cipher =
Aes256Gcm16::new_from_slice(&key).map_err(|e| anyhow::anyhow!("invalid AES key: {e}"))?;
let nonce = aes_gcm::aead::generic_array::GenericArray::from_slice(iv);
let plain = cipher
.decrypt(nonce, ct_with_tag.as_ref())
.map_err(|e| anyhow::anyhow!("AES-GCM decrypt failed: {e}"))?;
String::from_utf8(plain).context("handoff plaintext is not UTF-8")
}
/// Decode the shared encryption key into 32 raw AES bytes.
///
/// Accepts, in order of preference:
/// 1. base64url without padding — the current backend format (e.g.
/// a 43-char alphanumeric string using `-` / `_`). This must be tried
/// BEFORE standard base64 because `-`/`_` are invalid in the standard
/// alphabet and would fail cleanly, whereas a standard-base64 string
/// never contains `-`/`_` so base64url_no_pad will still decode it
/// correctly as long as there's no padding.
/// 2. base64url with padding.
/// 3. Standard base64 with padding (legacy backend format).
/// 4. Standard base64 without padding.
/// 5. A raw 32-byte ASCII key (len == 32, used as-is).
///View on GitHub (pinned to 7491200858)