zed-industries/zed · error

missing query path

Error message

missing query path

What it means

The git_log_context CLI was invoked with a worktree path but no second positional argument, the query path. run() requires exactly two positional args; this sentinel error is returned after printing usage and the process exits with FAILURE before any repository access.

Source

Thrown at crates/edit_prediction_context/src/git_log_context.rs:141

    }
}

#[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());
    }

    Ok(())
}

#[allow(dead_code)]

View on GitHub (pinned to f4178619ac)

Solutions

  1. Pass the query path as the second positional argument after the worktree path
  2. Verify argument ordering — usage is printed on stderr when this fails
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/edit_prediction_context/src/git_log_context.rs:141 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/f6bc11078ec35836. Report an issue: GitHub.