{"record":{"id":"973173a74338c1fe","repo":"zed-industries/zed","slug":"missing-worktree-path","errorCode":null,"errorMessage":"missing worktree path","messagePattern":"missing worktree path","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/edit_prediction_context/src/git_log_context.rs","lineNumber":137,"sourceCode":"        Err(error) => {\n            eprintln!(\"{error:#}\");\n            ExitCode::FAILURE\n        }\n    }\n}\n\n#[allow(dead_code)]\nfn run() -> Result<()> {\n    let mut arguments = env::args_os();\n    let program_name = arguments\n        .next()\n        .and_then(|path| PathBuf::from(path).file_name().map(|name| name.to_owned()))\n        .and_then(|name| name.into_string().ok())\n        .unwrap_or_else(|| \"git_log_context\".to_string());\n\n    let worktree_dir = arguments.next().ok_or_else(|| {\n        print_usage(&program_name);\n        anyhow!(\"missing worktree path\")\n    })?;\n    let query_path = arguments.next().ok_or_else(|| {\n        print_usage(&program_name);\n        anyhow!(\"missing query path\")\n    })?;\n    if arguments.next().is_some() {\n        print_usage(&program_name);\n        bail!(\"too many arguments\");\n    }\n\n    let worktree_dir = PathBuf::from(worktree_dir);\n    let query_path = normalize_query_path(&worktree_dir, &PathBuf::from(query_path));\n    let index = futures::executor::block_on(build_git_log_index(&worktree_dir))?;\n\n    for (path, count) in index.get_related_with_counts(&query_path, 10) {\n        println!(\"{count}\\t{}\", path.display());\n    }\n","sourceCodeStart":119,"sourceCodeEnd":155,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/edit_prediction_context/src/git_log_context.rs#L119-L155","documentation":"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.","triggerScenarios":"Thrown at crates/edit_prediction_context/src/git_log_context.rs:137 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f4178619acd0d47ea1f76a2025c42962c6d6638c","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}