{"record":{"id":"eb0fa867f8858f55","repo":"astrid-runtime/astrid","slug":"legacy-audit-tree-contains-a-special-file","errorCode":null,"errorMessage":"legacy audit tree contains a special file: {}","messagePattern":"legacy audit tree contains a special file: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-kernel/src/legacy_migration_barrier/host_fs.rs","lineNumber":552,"sourceCode":"        let child_metadata = fs::symlink_metadata(&child).map_err(io::Error::other)?;\n        if child_metadata.file_type().is_symlink()\n            || device_id(&child_metadata) != root_device\n            || active_mountpoint(&child)?\n        {\n            return Err(io::Error::new(\n                io::ErrorKind::InvalidData,\n                format!(\n                    \"legacy audit tree contains a redirect or boundary: {}\",\n                    child.display()\n                ),\n            ));\n        }\n        if child_metadata.is_dir() {\n            validate_audit_tree(&child, root_device)?;\n        } else if child_metadata.is_file() {\n            astrid_core::platform_fs::verify_no_redirects(&child)?;\n        } else {\n            return Err(io::Error::new(\n                io::ErrorKind::InvalidData,\n                format!(\n                    \"legacy audit tree contains a special file: {}\",\n                    child.display()\n                ),\n            ));\n        }\n    }\n    Ok(())\n}\n\n#[cfg(not(unix))]\nfn delete_audit_tree(path: &Path, root_device: u64) -> io::Result<()> {\n    validate_audit_tree(path, root_device)?;\n    for entry in fs::read_dir(path).map_err(io::Error::other)? {\n        let child = entry.map_err(io::Error::other)?.path();\n        let metadata = fs::symlink_metadata(&child).map_err(io::Error::other)?;\n        if metadata.is_dir() {","sourceCodeStart":534,"sourceCodeEnd":570,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-kernel/src/legacy_migration_barrier/host_fs.rs#L534-L570","documentation":"The legacy audit tree may contain only directories and regular files. When validate_audit_tree's recursion encounters a child that is neither (fifo, socket, device node, etc.), it aborts with InvalidData. Special files can block or hijack deletion/renaming and indicate a layout the migration barrier does not admit.","triggerScenarios":"Retiring, preflighting, or deleting an audit tree that contains a fifo (named pipe), unix socket, or device node among its entries; the else-branch of the per-child check fires.","commonSituations":"An application once wrote its socket or pipe into the audit directory; leftover mkfifo test artifacts; device nodes created by misconfigured tooling.","solutions":["Stop the process using the fifo/socket inside the audit tree and remove the special file.","Move any still-needed special file out of the audit directory to a runtime location (e.g. /run).","Re-run migration once the tree holds only regular files and directories."],"exampleFix":"// before\nsrwxr-xr-x audit.sock  in ~/.astrid/principal/audit/\n// after\nmv ~/.astrid/principal/audit/audit.sock /run/myapp/audit.sock\n# or: rm ~/.astrid/principal/audit/audit.sock","handlingStrategy":"validation","validationCode":"fn no_special_files(root: &Path) -> std::io::Result<bool> {\n    for entry in std::fs::read_dir(root)? {\n        let m = std::fs::symlink_metadata(entry?.path())?;\n        if !m.is_dir() && !m.is_file() { return Ok(false); }\n    }\n    Ok(true)\n}","typeGuard":null,"tryCatchPattern":"if let Err(e) = migrate_legacy_audit(&home, &source) {\n    if e.to_string().contains(\"special file\") {\n        // remove/relocate the named fifo/socket/device and retry\n    }\n}","preventionTips":["Keep sockets and fifos in /run or another runtime dir, never in audit data.","Scan with `find <audit-dir> ! -type f ! -type d` before migrating.","Stop legacy daemons that create special files in the audit path."],"tags":["filesystem","special-file","migration","validation"],"backgroundTag":"incompatible-source-type","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"}