{"record":{"id":"552bc6295b2bb5aa","repo":"astrid-runtime/astrid","slug":"legacy-revocation-file-exceeds-entry-cap","errorCode":null,"errorMessage":"legacy revocation file exceeds entry cap","messagePattern":"legacy revocation file exceeds entry cap","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-gateway/src/revocations.rs","lineNumber":380,"sourceCode":"    };\n    if metadata.file_type().is_symlink() || !metadata.is_file() {\n        anyhow::bail!(\n            \"legacy gateway revocation path is not a regular file: {}\",\n            path.display()\n        );\n    }\n    if metadata.len() > MAX_REVOCATIONS_FILE_BYTES {\n        anyhow::bail!(\"legacy revocation file exceeds migration cap\");\n    }\n    let bytes = read_legacy_bytes(&path)?;\n    let text = std::str::from_utf8(&bytes).context(\"legacy revocation file is not UTF-8\")?;\n    let raw: HashMap<String, u64> = if text.trim().is_empty() {\n        HashMap::new()\n    } else {\n        serde_json::from_str(text).with_context(|| format!(\"parse {}\", path.display()))?\n    };\n    if raw.len() > MAX_REVOCATION_ENTRIES {\n        anyhow::bail!(\"legacy revocation file exceeds entry cap\");\n    }\n    let digest = blake3::hash(&bytes).to_hex().to_string();\n    let entries = raw\n        .into_iter()\n        .map(|(alias, epoch)| {\n            PrincipalId::new(&alias)\n                .map(|principal| (principal, epoch))\n                .map_err(|error| anyhow::anyhow!(\"invalid principal {alias:?}: {error}\"))\n        })\n        .collect::<anyhow::Result<Vec<_>>>()?;\n    for (principal, epoch) in &entries {\n        record_principal_max(store, principal, *epoch).await?;\n    }\n    let (principals, _) = load_from_store(store).await?;\n    for (principal, epoch) in &entries {\n        let durable = principals.get(principal).copied().ok_or_else(|| {\n            anyhow::anyhow!(\"principal revocation {principal} missing after migration\")\n        })?;","sourceCodeStart":362,"sourceCodeEnd":398,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-gateway/src/revocations.rs#L362-L398","documentation":"Size guard in migrate_legacy_file: the legacy JSON revocation file exceeded the migration byte cap, so the one-time import is aborted instead of ingesting a suspiciously large file into the control KV.","triggerScenarios":"Thrown at crates/astrid-gateway/src/revocations.rs:380 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the legacy JSON for corruption or duplicated entries and trim it","Complete migration with a hand-curated, capped file and write the receipt manually","Confirm the KV already holds the epochs, then delete the legacy file"],"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"}