{"record":{"id":"6ec714e07af1dd82","repo":"astrid-runtime/astrid","slug":"managed-install-entry-is-redirected-or-not-regular","errorCode":null,"errorMessage":"managed install entry is redirected or not regular: {name}","messagePattern":"managed install entry is redirected or not regular: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-cli/src/commands/self_update/mod.rs","lineNumber":496,"sourceCode":"fn apply_authenticated_update<F>(\n    install_dir: &Path,\n    extract_dir: &Path,\n    target: &str,\n    install_native_assets: F,\n) -> anyhow::Result<()>\nwhere\n    F: FnOnce(&Path, &Path) -> anyhow::Result<()>,\n{\n    prepare_macos_update_assets(extract_dir, target)?;\n    let managed = managed_binaries_for_target(target);\n    let previously_present = managed\n        .iter()\n        .map(\n            |name| match std::fs::symlink_metadata(install_dir.join(name)) {\n                Ok(metadata) if metadata.is_file() && !metadata.file_type().is_symlink() => {\n                    Ok(true)\n                },\n                Ok(_) => bail!(\"managed install entry is redirected or not regular: {name}\"),\n                Err(error) if error.kind() == std::io::ErrorKind::NotFound => Ok(false),\n                Err(error) => Err(error.into()),\n            },\n        )\n        .collect::<anyhow::Result<Vec<_>>>()?;\n    backup_and_swap(install_dir, extract_dir, &managed)?;\n    if target.contains(\"-apple-darwin\")\n        && let Err(native_error) = install_native_assets(extract_dir, install_dir)\n    {\n        return match restore_managed_set(install_dir, &managed, &previously_present) {\n            Ok(()) => Err(native_error.context(\n                \"macOS app update failed; the prior managed Astrid set was restored\",\n            )),\n            Err(rollback_error) => Err(native_error.context(format!(\n                \"macOS app update failed and managed-set rollback also failed ({rollback_error}); restore the retained *.bak files manually\"\n            ))),\n        };\n    }","sourceCodeStart":478,"sourceCodeEnd":514,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-cli/src/commands/self_update/mod.rs#L478-L514","documentation":"During apply_authenticated_update, before swapping in a new build, the updater verifies that every managed install entry is a regular file (checked via symlink_metadata so symlinked entries are rejected). If a managed binary name resolves to a symlink, directory, or other non-regular entry, the self-update aborts rather than overwrite something it does not own. This protects against hijacked installs (e.g. a binary replaced by a symlink to a user-managed tool like Homebrew or cargo shim).","triggerScenarios":"Running `astrid self update` on an install where one of the managed binaries in the install directory is a symlink or a non-file entry. Most often: the binary at install_dir/<name> is a symlink into Homebrew, cargo, nix, or a user-local bin directory.","commonSituations":"User first installed via Homebrew/cargo and later copied a release build into a directory, or an admin symlinked the binary into a shared install dir; also seen when the updater's install dir was pre-populated with wrappers/symlinks from a package manager.","solutions":["Remove the symlink and place a real (self-managed) binary there: `rm <install_dir>/<name> && cp <real-binary> <install_dir>/<name>`.","If the install is actually package-manager-managed, do not use self-update; upgrade via the managing tool (brew upgrade / cargo install) instead.","Reinstall Astrid via the official self-managed installer so all managed entries are regular files, then re-run self-update."],"exampleFix":"// before (managed entry is a symlink)\nlrwxr-xr-x astrid -> /opt/homebrew/bin/astrid   # self-update bails\n\n// after (regular file, self-managed)\n$ rm /usr/local/bin/astrid\n$ cp target/release/astrid /usr/local/bin/astrid\n$ astrid self update","handlingStrategy":"validation","validationCode":"let meta = std::fs::symlink_metadata(install_dir.join(name))?;\nif !meta.is_file() || meta.file_type().is_symlink() {\n    eprintln!(\"{name} is not a regular file; resolve the install before self-update\");\n}","typeGuard":"fn is_regular_file(p: &std::path::Path) -> bool {\n    std::fs::symlink_metadata(p)\n        .map(|m| m.is_file() && !m.file_type().is_symlink())\n        .unwrap_or(false)\n}","tryCatchPattern":null,"preventionTips":["Never symlink package-manager binaries into a directory you intend to self-update.","Install Astrid self-managed via the official installer so managed entries are real files.","Before updating, run `ls -la` on the install dir and replace any symlinks with copies."],"tags":["self-update","symlink","install-layout","safety-check"],"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"}