{"record":{"id":"325de432776c29a9","repo":"astrid-runtime/astrid","slug":"legacy-capsule-authority-root-contains-a-non-regul","errorCode":null,"errorMessage":"legacy capsule authority root contains a non-regular entry: {}","messagePattern":"legacy capsule authority root contains a non-regular entry: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-capsule-install/src/authority/leftover.rs","lineNumber":255,"sourceCode":"    }\n    astrid_core::platform_fs::verify_no_redirects(&directory).with_context(|| {\n        format!(\n            \"verify legacy capsule authority root {}\",\n            directory.display()\n        )\n    })?;\n    let mut paths = Vec::new();\n    let mut entries = fs::read_dir(&directory)\n        .with_context(|| format!(\"read legacy capsule authority root {}\", directory.display()))?\n        .collect::<Result<Vec<_>, _>>()\n        .with_context(|| format!(\"read legacy capsule authority root {}\", directory.display()))?;\n    entries.sort_by_key(fs::DirEntry::file_name);\n    for entry in entries {\n        let path = entry.path();\n        let metadata = fs::symlink_metadata(&path)\n            .with_context(|| format!(\"inspect leftover capsule authority {}\", path.display()))?;\n        if metadata.file_type().is_symlink() || !metadata.is_file() {\n            bail!(\n                \"legacy capsule authority root contains a non-regular entry: {}\",\n                path.display()\n            );\n        }\n        if path\n            .extension()\n            .is_some_and(|extension| extension.eq_ignore_ascii_case(\"json\"))\n        {\n            paths.push(path);\n        }\n    }\n    Ok(paths)\n}\n\nfn unique_quarantine_path(root: &Path, file_name: &std::ffi::OsStr) -> anyhow::Result<PathBuf> {\n    let encoded = encoded_file_name(file_name);\n    for index in 0_u32..1024 {\n        let candidate = if index == 0 {","sourceCodeStart":237,"sourceCodeEnd":273,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-capsule-install/src/authority/leftover.rs#L237-L273","documentation":"active_receipt_files uses fs::symlink_metadata on each entry of the legacy authority root and requires every entry to be a regular file. If any entry is a symlink, directory, or other special file, the library throws this error to avoid reading receipt data through redirected or non-file objects.","triggerScenarios":"Calling unique_relocated_receipt → active_receipt_files when any entry under the authority root (leftover.rs:255) fails the is_file/not-symlink check — e.g. a subdirectory was created inside the authority directory, or a receipt was replaced by a symlink.","commonSituations":"User manually creating a subfolder (backup/, old/) inside the authority directory; dotfile manager symlinking individual receipts; a named pipe or socket accidentally placed there.","solutions":["Move any subdirectories out of the authority root (e.g. mv backup/ ~/astrid-backup/) so only regular receipt files remain","Replace symlinked receipt files with real copies (rm symlink; cp target into place)","Exclude ~/.astrid/authority from symlink-based dotfile management","List entries with find ~/.astrid/authority ! -type f to locate the offending entry"],"exampleFix":"// before\n~/.astrid/authority/old/ (subdirectory present)\n// after\n$ mv ~/.astrid/authority/old ~/astrid-archive/old\n$ astrid migrate  # scan succeeds","handlingStrategy":"validation","validationCode":"for entry in std::fs::read_dir(authority_root)? {\n    let md = entry?.metadata()?;\n    if !md.is_file() {\n        anyhow::bail!(\"non-regular entry in authority root\");\n    }\n}","typeGuard":"fn all_entries_regular(dir: &Path) -> bool {\n    std::fs::read_dir(dir).map(|rd| rd.filter_map(Result::ok)\n        .all(|e| std::fs::symlink_metadata(e.path()).map(|m| m.is_file()).unwrap_or(false))).unwrap_or(false)\n}","tryCatchPattern":null,"preventionTips":["Keep the authority directory flat — no subdirectories or special files","Never symlink individual receipts; copy real files instead","Periodically run: find <authority-root> ! -type f -print as a hygiene check"],"tags":["filesystem","symlink","security"],"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"}