{"record":{"id":"6c2655ee4aded2d0","repo":"astrid-runtime/astrid","slug":"legacy-revocation-file-exceeds-migration-cap","errorCode":null,"errorMessage":"legacy revocation file exceeds migration cap","messagePattern":"legacy revocation file exceeds migration cap","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-gateway/src/revocations.rs","lineNumber":97,"sourceCode":"fn read_legacy_bytes(path: &std::path::Path) -> anyhow::Result<Vec<u8>> {\n    #[cfg(unix)]\n    let file = {\n        use std::os::unix::fs::OpenOptionsExt as _;\n        std::fs::OpenOptions::new()\n            .read(true)\n            .custom_flags(nix::libc::O_NOFOLLOW | nix::libc::O_CLOEXEC)\n            .open(path)\n            .with_context(|| format!(\"open legacy revocation file {}\", path.display()))?\n    };\n    #[cfg(not(unix))]\n    let file = std::fs::File::open(path)\n        .with_context(|| format!(\"open legacy revocation file {}\", path.display()))?;\n    let mut bytes = Vec::new();\n    file.take(MAX_REVOCATIONS_FILE_BYTES.saturating_add(1))\n        .read_to_end(&mut bytes)\n        .with_context(|| format!(\"read legacy revocation file {}\", path.display()))?;\n    if bytes.len() as u64 > MAX_REVOCATIONS_FILE_BYTES {\n        anyhow::bail!(\"legacy revocation file exceeds migration cap\");\n    }\n    Ok(bytes)\n}\n\nfn decode_epoch(bytes: &[u8], key: &str) -> anyhow::Result<u64> {\n    let raw: [u8; 8] = bytes.try_into().map_err(|_| {\n        anyhow::anyhow!(\n            \"revocation KV value for {key:?} has {} bytes; expected 8\",\n            bytes.len()\n        )\n    })?;\n    Ok(u64::from_le_bytes(raw))\n}\n\nfn encode_epoch(epoch: u64) -> Vec<u8> {\n    epoch.to_le_bytes().to_vec()\n}\n","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-gateway/src/revocations.rs#L79-L115","documentation":"Size guard in read_legacy_bytes: the legacy revocation JSON exceeded MAX_REVOCATIONS_FILE_BYTES, so it is refused before being parsed — an unexpectedly huge file suggests corruption or tampering rather than a legitimate index.","triggerScenarios":"Thrown at crates/astrid-gateway/src/revocations.rs:97 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the file; truncate or split it if it grew abnormally","Complete the migration into the control KV and remove the legacy file","Restore a sane legacy file from backup, then re-run startup"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"affd8760f44190dbdfbec23403f4c4b642c33112","analyzedAt":"2026-09-09T21:28:12.402Z","contentChangedAt":"2026-09-09T21:28:12.402Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}