astrid-runtime/astrid · error
cannot resolve install directory for
Error message
cannot resolve install directory for {} What it means
run_self_update determines the installation directory from the current executable path. If std::env::current_exe's path has no parent (e.g. the exe sits at a filesystem root or the path is bare), the install directory cannot be resolved and the update aborts with this message naming the executable path.
Solutions
- Move/install the binary into a normal directory (e.g. /usr/local/bin) and retry
- Invoke the binary via its full path within a directory (not the filesystem root)
- Fall back to installing via Homebrew or cargo instead of self-update
- Check std::env::current_exe resolution in the environment (container/chroot quirks)
Example fix
// before /astrid self-update # binary at filesystem root // after sudo mv /astrid /usr/local/bin/astrid && astrid self-update
Defensive patterns
Strategy: validation
Validate before calling
let exe = std::env::current_exe()?;
let install_dir = exe.parent().context("binary has no parent directory; install into a normal dir")?;
anyhow::ensure!(is_writable_dir(install_dir), "{} not writable", install_dir.display()); Try / catch
match std::env::current_exe().and_then(|exe| exe.parent().map(|p| p.to_path_buf()).ok_or_else(|| anyhow::anyhow!("no parent dir"))) {
Ok(dir) => update_in(dir),
Err(e) => eprintln!("self-update unavailable: {e}; use Homebrew or cargo install instead"),
} Prevention
- Install the binary into a standard directory (/usr/local/bin, ~/.cargo/bin), never the filesystem root
- Invoke the CLI via a path that includes a directory component
- Prefer package-manager installation in containers/chroots
- Check current_exe resolution when running under unusual namespaces
When it happens
Trigger: Running the self-update when exe.parent() returns None — the binary is located at a path root (e.g. /astrid), invoked via a path with no directory component, or current_exe returns an unusual path on the platform.
Common situations: Binary copied to the filesystem root; exotic container/namespace setups where current_exe resolves oddly; running the binary through a mechanism that presents a parentless path.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- Astrid volume is not a regular file
- capsule source is neither a directory nor a regular file
- capsule target has no parent
- {detail}: {error}
- executable replacement directories must exist
AI-assisted analysis of astrid-runtime/astrid@affd8760f4 (2026-09-09).
Data as JSON: /api/errors/fca177478521a7ee.
Report an issue: GitHub.
Appendix: source
Thrown at crates/astrid-cli/src/commands/self_update/mod.rs:615
))
);
return Ok(());
},
UpdatePlan::DeferToManager { manager, how } => {
println!(
"{}",
Theme::info(&format!(
"Astrid was installed via {manager}. Update it with:\n {how}"
))
);
return Ok(());
},
UpdatePlan::ApplyInPlace => {},
}
let install_dir = exe
.parent()
.ok_or_else(|| anyhow::anyhow!("cannot resolve install directory for {}", exe.display()))?
.to_path_buf();
if !is_writable_dir(&install_dir) {
bail!(
"{} is not writable — re-run with elevated permissions, or reinstall via Homebrew/cargo.",
install_dir.display()
);
}
if !confirm(
&format!(
"Update Astrid v{CURRENT_VERSION} → v{version_str} in {}?",
install_dir.display()
),
args.yes,
)? {
println!("{}", Theme::dimmed("Update cancelled."));
return Ok(());
}View on GitHub (pinned to affd8760f4)