{"record":{"id":"168004d69da53ed4","repo":"astrid-runtime/astrid","slug":"unsupported-legacy-audit-source-audit-source-on","errorCode":null,"errorMessage":"unsupported legacy audit source {audit_source}; only the default principal source is admitted","messagePattern":"unsupported legacy audit source (.+?); only the default principal source is admitted","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-kernel/src/lib.rs","lineNumber":4194,"sourceCode":"        let audit_source = local_root.join(\"audit\");\n        let audit_metadata = match std::fs::symlink_metadata(&audit_source) {\n            Ok(metadata) => metadata,\n            Err(error) if error.kind() == std::io::ErrorKind::NotFound => continue,\n            Err(error) => return Err(error),\n        };\n        if audit_source == default_source {\n            default_source_present = true;\n            validate_audit_tree(&audit_source, audit_tree_device(&audit_metadata))?;\n            continue;\n        }\n        if std::fs::read_dir(&audit_source)?\n            .next()\n            .transpose()?\n            .is_none()\n        {\n            continue;\n        }\n        return Err(std::io::Error::new(\n            std::io::ErrorKind::AlreadyExists,\n            format!(\n                \"unsupported legacy audit source {}; only the default principal source is admitted\",\n                audit_source.display()\n            ),\n        ));\n    }\n    Ok(default_source_present)\n}\n\n/// Derived observer helper for optional post-cutover recertify.\n/// Layout-2 boot and legacy cutover do not call this.\n#[allow(dead_code, reason = \"Refinery/observer recertify; not a boot gate\")]\npub(crate) fn require_audit_integrity(\n    results: &[(\n        astrid_core::SessionId,\n        astrid_audit::ChainVerificationResult,\n    )],","sourceCodeStart":4176,"sourceCodeEnd":4212,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-kernel/src/lib.rs#L4176-L4212","documentation":"While scanning the legacy home for audit sources, the kernel found a directory it does not recognize. Only the default principal audit source can be migrated automatically; any other audit directory would need manual handling, so the migration aborts with AlreadyExists to force an explicit decision.","triggerScenarios":"Running the legacy principal-home migration when an alternate/legacy audit source directory (from an older layout or a non-default principal id) exists alongside the default one.","commonSituations":"Upgrading from a very old version that used a different audit directory naming scheme; multiple principal profiles sharing one home; leftover directories from a previous aborted migration.","solutions":["Identify the unrecognized audit directory and manually move it into migrations_dir/audit-principal-home.retired after verifying its contents","Delete the stale audit directory if its data is no longer needed","Check release/upgrade notes to map the legacy audit source name to its current equivalent"],"exampleFix":"// before: leftover legacy audit dir blocks migration\n~/app/audit-old/\n// after: retire it manually first\nmv ~/app/audit-old ~/.app/migrations/audit-principal-home.retired","handlingStrategy":"validation","validationCode":"// before migrating, ensure no unexpected audit dirs exist\nfn unexpected_audit_sources(legacy_root: &std::path::Path, allowed: &std::path::Path) -> std::io::Result<Vec<std::path::PathBuf>> {\n    Ok(std::fs::read_dir(legacy_root)?\n        .filter_map(|e| e.ok())\n        .map(|e| e.path())\n        .filter(|p| p.file_name().map_or(false, |n| n.to_string_lossy().contains(\"audit\")) && p != allowed)\n        .collect())\n}","typeGuard":"fn is_default_audit_source(p: &std::path::Path, expected: &std::path::Path) -> bool {\n    p == expected\n}","tryCatchPattern":"match run_migration() {\n    Err(e) if e.kind() == std::io::ErrorKind::AlreadyExists\n        && e.to_string().contains(\"unsupported legacy audit source\") => {\n        // inspect and manually retire the unrecognized audit dir, then retry\n    }\n    r => r?,\n}","preventionTips":["Inventory legacy audit directories before upgrading","Read upgrade notes for renamed audit layouts","Clean up aborted migrations before retrying"],"tags":["migration","audit","unsupported","rust"],"backgroundTag":"invalid-argument-value","analyzedSha":"affd8760f44190dbdfbec23403f4c4b642c33112","analyzedAt":"2026-09-09T21:28:12.402Z","contentChangedAt":"2026-09-09T21:28:12.402Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}