{"record":{"id":"cbd7879931bc3521","repo":"zed-industries/zed","slug":"failed-to-stage-paths","errorCode":null,"errorMessage":"Failed to stage paths:\n{}","messagePattern":"Failed to stage paths:\n(.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/git/src/repository.rs","lineNumber":2498,"sourceCode":"    }\n\n    fn stage_paths(\n        &self,\n        paths: Vec<RepoPath>,\n        env: Arc<HashMap<String, String>>,\n    ) -> BoxFuture<'_, Result<()>> {\n        let git = self.git_binary_in_worktree();\n        self.executor\n            .spawn(async move {\n                let git = git?;\n                if !paths.is_empty() {\n                    let output = git\n                        .build_command(&[\"update-index\", \"--add\", \"--remove\", \"--\"])\n                        .envs(env.iter())\n                        .args(paths.iter().map(|p| p.as_unix_str()))\n                        .output()\n                        .await?;\n                    anyhow::ensure!(\n                        output.status.success(),\n                        \"Failed to stage paths:\\n{}\",\n                        String::from_utf8_lossy(&output.stderr),\n                    );\n                }\n                Ok(())\n            })\n            .boxed()\n    }\n\n    fn unstage_paths(\n        &self,\n        paths: Vec<RepoPath>,\n        env: Arc<HashMap<String, String>>,\n    ) -> BoxFuture<'_, Result<()>> {\n        let git = self.git_binary_in_worktree();\n\n        self.executor","sourceCodeStart":2480,"sourceCodeEnd":2516,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/git/src/repository.rs#L2480-L2516","documentation":"ensure! guard failing when `git update-index --add --remove -- <paths...>` exits non-zero while staging a batch of paths. Commonly caused by a locked index, paths outside the repository, or unreadable files.","triggerScenarios":"Thrown at crates/git/src/repository.rs:2498 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check git stderr embedded in the error for the offending path","Remove a stale .git/index.lock and retry","Ensure all requested paths are inside the repo worktree","Retry staging the paths individually to isolate the failing one"],"exampleFix":null,"handlingStrategy":"try-catch","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-14T05:17:10.506Z"}