nikivdev/code · error · anyhow::Error
direnv is not on PATH. Install it from https://direnv.net/#i
Error message
direnv is not on PATH. Install it from https://direnv.net/#installation and rerun `flow doctor`.
What it means
flow doctor requires direnv for environment loading. ensure_direnv_on_path checks `which direnv`; before failing it attempts an automatic install via zerobrew. If that install fails or does not put direnv on PATH, it bails with the official install link.
Source
Thrown at src/doctor.rs:116
vcs::ensure_jj_installed()?;
println!("✅ jj found on PATH");
Ok(())
}
fn ensure_direnv_on_path(zerobrew_available: bool) -> Result<()> {
match which::which("direnv") {
Ok(path) => {
println!("✅ direnv found at {}", path.display());
Ok(())
}
Err(_) => {
if maybe_install_with_zerobrew(zerobrew_available, "direnv", "direnv")? {
if let Ok(path) = which::which("direnv") {
println!("✅ direnv installed via zerobrew at {}", path.display());
return Ok(());
}
}
bail!(
"direnv is not on PATH. Install it from https://direnv.net/#installation and rerun `flow doctor`."
)
}
}
}
fn find_bundled_lin() -> Option<PathBuf> {
let exe_dir = std::env::current_exe()
.ok()
.and_then(|p| p.parent().map(PathBuf::from))?;
let candidate = exe_dir.join("lin");
if candidate.exists() {
Some(candidate)
} else {
None
}
}
View on GitHub (pinned to a747e741ae)
Solutions
- Install direnv per https://direnv.net/#installation and rerun `flow doctor`
- Install zerobrew first so the doctor's automatic direnv install can run
- Add direnv's install location to your PATH
Defensive patterns
Strategy: validation
Validate before calling
if which::which("direnv").is_err() {
eprintln!("direnv missing; install from https://direnv.net/#installation");
} Prevention
- Install direnv via your package manager during setup
- Ensure zerobrew is available if you rely on the doctor's auto-install
- Confirm `direnv hook` is wired into your shell and the binary resolves
When it happens
Trigger: Running `flow doctor` when direnv is not on PATH and the zerobrew auto-install either was skipped (zerobrew unavailable), reported failure, or installed to a directory not on PATH.
Common situations: Fresh machine setup, zerobrew not installed so auto-install cannot happen, or direnv installed via an unsupported package manager to a non-PATH location.
Related errors
- lin is not on PATH. Build/install from this repo (scripts/de
- handled before project context load
- ai not found in PATH
- flox is not installed. Install it from https://flox.dev/docs
- jj is required but not available on PATH
AI-assisted analysis of nikivdev/code@a747e741ae (2026-09-01).
Data as JSON: /api/errors/d8fdbfa98920bc9d.
Report an issue: GitHub.