astrid-runtime/astrid · error
legacy log
Error message
legacy log {}: {detail} What it means
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.
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
Defensive patterns
Strategy: validation
Try / catch
if let Some(e) = err.downcast_ref::<io::Error>() {
if e.kind() == io::ErrorKind::InvalidData && msg.starts_with("legacy log ") {
// parse the path and detail from the message; restore or rebuild that artifact
}
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
Related errors
- legacy audit tree contains a special file
- legacy principal-home entry is not a regular directory
- legacy principal-home root is not a directory
- absent migration source has a digest
- Astrid volume is not a regular file
AI-assisted analysis of astrid-runtime/astrid@affd8760f4 (2026-09-09).
Data as JSON: /api/errors/9959e5ed9ee95821.
Report an issue: GitHub.
Appendix: source
Thrown at crates/astrid-kernel/src/principal_log_migration.rs:547
0
}
}
// Windows retirement uses write-through platform helpers; retain the common
// fallible signature for the cross-platform migration flow.
#[cfg_attr(not(unix), allow(clippy::unnecessary_wraps))]
fn sync_parent(path: &Path) -> io::Result<()> {
#[cfg(unix)]
if let Some(parent) = path.parent() {
File::open(parent)?.sync_all()?;
}
#[cfg(not(unix))]
let _ = path;
Ok(())
}
fn invalid(path: &Path, detail: &str) -> io::Error {
io::Error::new(
io::ErrorKind::InvalidData,
format!("legacy log {}: {detail}", path.display()),
)
}
fn conflict(path: &Path, detail: &str) -> io::Error {
io::Error::new(
io::ErrorKind::AlreadyExists,
format!("legacy log conflict at {}: {detail}", path.display()),
)
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn migrates_logs_to_uid_projection_and_is_idempotent() {View on GitHub (pinned to affd8760f4)