{"record":{"id":"9959e5ed9ee95821","repo":"astrid-runtime/astrid","slug":"legacy-log-detail","errorCode":null,"errorMessage":"legacy log {}: {detail}","messagePattern":"legacy log (.+?): (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-kernel/src/principal_log_migration.rs","lineNumber":547,"sourceCode":"        0\n    }\n}\n\n// Windows retirement uses write-through platform helpers; retain the common\n// fallible signature for the cross-platform migration flow.\n#[cfg_attr(not(unix), allow(clippy::unnecessary_wraps))]\nfn sync_parent(path: &Path) -> io::Result<()> {\n    #[cfg(unix)]\n    if let Some(parent) = path.parent() {\n        File::open(parent)?.sync_all()?;\n    }\n    #[cfg(not(unix))]\n    let _ = path;\n    Ok(())\n}\n\nfn invalid(path: &Path, detail: &str) -> io::Error {\n    io::Error::new(\n        io::ErrorKind::InvalidData,\n        format!(\"legacy log {}: {detail}\", path.display()),\n    )\n}\n\nfn conflict(path: &Path, detail: &str) -> io::Error {\n    io::Error::new(\n        io::ErrorKind::AlreadyExists,\n        format!(\"legacy log conflict at {}: {detail}\", path.display()),\n    )\n}\n\n#[cfg(test)]\nmod tests {\n    use super::*;\n\n    #[test]\n    fn migrates_logs_to_uid_projection_and_is_idempotent() {","sourceCodeStart":529,"sourceCodeEnd":565,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-kernel/src/principal_log_migration.rs#L529-L565","documentation":"Generic InvalidData constructor for legacy log migration problems, produced by the `invalid(path, detail)` helper. It prefixes the offending path with \"legacy log\" and appends a specific detail (e.g. non-canonical JSON, bad entry, invalid name). It signals that some on-disk legacy log artifact fails a structural validation check.","triggerScenarios":"Any validation failure in `inventory`, `walk_inventory`, `preflight_destination`, `copy_entry`, `retire_source`, or `read_receipt_bytes` that calls `invalid(path, detail)` — e.g. \"legacy log receipt is not canonical JSON\", malformed entries, invalid file naming encountered while walking the legacy log tree.","commonSituations":"Hand-modified or partially restored legacy log directories; files added by other tools into the legacy log area; format drift between app versions writing different structures into the same home.","solutions":["Read the `detail` suffix in the message to identify the exact structural problem at the given path","Restore the flagged path from backup or remove/rebuild the legacy log via the migration flow","Stop editing legacy log files manually; regenerate them with the tooling","If it followed an upgrade, re-run the migration after clearing the offending artifact"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":"if let Some(e) = err.downcast_ref::<io::Error>() {\n    if e.kind() == io::ErrorKind::InvalidData && msg.starts_with(\"legacy log \") {\n        // parse the path and detail from the message; restore or rebuild that artifact\n    }\n}","preventionTips":["Leave legacy log directories untouched; let the kernel own them","Restore homes only from complete, consistent backups","Validate/inspect with the tool's inventory command before migrating"],"tags":["migration","validation","filesystem"],"backgroundTag":"invalid-argument-format","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"}