{"record":{"id":"ab198051cfa611a7","repo":"astrid-runtime/astrid","slug":"legacy-capsule-authority-root-is-not-a-regular-dir-ab1980","errorCode":null,"errorMessage":"legacy capsule authority root is not a regular directory: {}","messagePattern":"legacy capsule authority root is not a regular directory: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-capsule-install/src/authority/status.rs","lineNumber":46,"sourceCode":"///\n/// Returns an error when the receipt directory or one of its entries is\n/// redirected, special, or unreadable.\npub fn legacy_authority_receipt_status(\n    home: &AstridHome,\n    workspace_targets: &[PathBuf],\n) -> anyhow::Result<LegacyAuthorityReceiptStatus> {\n    let directory = home.etc_dir().join(AUTHORITY_RECEIPT_DIR);\n    let metadata = match std::fs::symlink_metadata(&directory) {\n        Ok(metadata) => metadata,\n        Err(error) if error.kind() == std::io::ErrorKind::NotFound => {\n            return Ok(LegacyAuthorityReceiptStatus::default());\n        },\n        Err(error) => {\n            return Err(error).with_context(|| format!(\"inspect {}\", directory.display()));\n        },\n    };\n    if metadata.file_type().is_symlink() || !metadata.is_dir() {\n        bail!(\n            \"legacy capsule authority root is not a regular directory: {}\",\n            directory.display()\n        );\n    }\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\n    let permitted = workspace_targets\n        .iter()\n        .map(|target| authority_paths(home, target).map(|paths| paths.active))\n        .collect::<anyhow::Result<BTreeSet<_>>>()?;\n    let mut status = LegacyAuthorityReceiptStatus::default();\n    let mut entries = std::fs::read_dir(&directory)\n        .with_context(|| format!(\"read legacy capsule authority root {}\", directory.display()))?","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-capsule-install/src/authority/status.rs#L28-L64","documentation":"legacy_authority_receipt_status validates that the legacy authority root is a plain directory (symlink_metadata: not a symlink, is_dir) before listing receipt status. If the path is a symlink or non-directory, this error is thrown — the library will not report status through a redirected filesystem object.","triggerScenarios":"Calling legacy_capsule_authority_status (or the test/CLI paths authority_status_blocks_unknown_but_preserves_workspace_portal_receipts) when the authority root at status.rs:46 is a symlink, a regular file, or another non-directory entry — usually because ~/.astrid/authority was symlinked by a dotfile manager or replaced by a file.","commonSituations":"chezmoi/stow symlinked .astrid; ASTRID_HOME misconfigured to a file path; an install script accidentally wrote a file at the authority path.","solutions":["Replace the symlink with a real directory (rm symlink; mkdir; copy contents back)","Correct ASTRID_HOME/workspace configuration to point at a genuine directory","Stop the dotfile manager from symlinking the authority directory and track its files directly","Confirm the path with stat before re-running the status command"],"exampleFix":"// before\n$ stat -c %F ~/.astrid/authority\nsymbolic link\n// after\n$ rm ~/.astrid/authority && mkdir ~/.astrid/authority\n$ cp -aL /dotfiles/authority/. ~/.astrid/authority/\n$ astrid authority status","handlingStrategy":"validation","validationCode":"let root = authority_root_path();\nlet md = std::fs::symlink_metadata(&root)?;\nif md.is_symlink() || !md.is_dir() {\n    eprintln!(\"{} is not a real directory; fix before checking status\", root.display());\n    std::process::exit(1);\n}","typeGuard":"fn authority_root_is_real_dir(p: &Path) -> bool {\n    std::fs::symlink_metadata(p).map(|m| !m.is_symlink() && m.is_dir()).unwrap_or(false)\n}","tryCatchPattern":null,"preventionTips":["Never symlink .astrid or its authority subdirectory from dotfile managers","Validate ASTRID_HOME points to a directory during setup scripts","Run stat on the path if status commands unexpectedly fail"],"tags":["filesystem","symlink","directory","security"],"backgroundTag":"path-is-not-a-directory","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"}