zed-industries/zed · error
missing worktree path
Error message
missing worktree path
What it means
The git_log_context CLI binary was invoked without the required worktree path positional argument. run() consumes args_os() and treats the first positional arg as the worktree dir; when absent it prints usage and returns this sentinel anyhow error, so the process exits with FAILURE after argument parsing, before any git work happens.
Source
Thrown at crates/edit_prediction_context/src/git_log_context.rs:137
Err(error) => {
eprintln!("{error:#}");
ExitCode::FAILURE
}
}
}
#[allow(dead_code)]
fn run() -> Result<()> {
let mut arguments = env::args_os();
let program_name = arguments
.next()
.and_then(|path| PathBuf::from(path).file_name().map(|name| name.to_owned()))
.and_then(|name| name.into_string().ok())
.unwrap_or_else(|| "git_log_context".to_string());
let worktree_dir = arguments.next().ok_or_else(|| {
print_usage(&program_name);
anyhow!("missing worktree path")
})?;
let query_path = arguments.next().ok_or_else(|| {
print_usage(&program_name);
anyhow!("missing query path")
})?;
if arguments.next().is_some() {
print_usage(&program_name);
bail!("too many arguments");
}
let worktree_dir = PathBuf::from(worktree_dir);
let query_path = normalize_query_path(&worktree_dir, &PathBuf::from(query_path));
let index = futures::executor::block_on(build_git_log_index(&worktree_dir))?;
for (path, count) in index.get_related_with_counts(&query_path, 10) {
println!("{count}\t{}", path.display());
}
View on GitHub (pinned to f4178619ac)
Solutions
- Invoke the binary with the worktree path as the first positional argument, e.g. git_log_context /path/to/worktree <query-path>
- If scripting the tool, check the argument count before spawning and emit the intended usage message yourself
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/edit_prediction_context/src/git_log_context.rs:137 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20).
Data as JSON: /api/errors/973173a74338c1fe.
Report an issue: GitHub.