{"record":{"id":"10bf5e8902254129","repo":"nikivdev/code","slug":"failed-to-resolve-git-repository-root","errorCode":null,"errorMessage":"failed to resolve git repository root","messagePattern":"failed to resolve git repository root","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/fix.rs","lineNumber":234,"sourceCode":"    println!(\"  1) Make the requested repair manually or in Codex\");\n    println!(\"  2) Review the diff\");\n    println!(\"  3) Run `f commit` to recreate the commit cleanly\");\n    if !preview.is_empty() {\n        println!(\"  Context: {}\", preview);\n    }\n}\n\nfn git_top_level() -> Result<std::path::PathBuf> {\n    let output = Command::new(\"git\")\n        .args([\"rev-parse\", \"--show-toplevel\"])\n        .output()\n        .context(\"failed to run git\")?;\n    if !output.status.success() {\n        bail!(\"not a git repository (or git not available)\");\n    }\n    let root = String::from_utf8_lossy(&output.stdout).trim().to_string();\n    if root.is_empty() {\n        bail!(\"failed to resolve git repository root\");\n    }\n    Ok(std::path::PathBuf::from(root))\n}\n\nfn ensure_clean_or_stash(\n    repo_root: &std::path::Path,\n    allow_stash: bool,\n    stashed: &mut bool,\n) -> Result<()> {\n    let status = git_output(repo_root, &[\"status\", \"--porcelain\"])?;\n    if status.trim().is_empty() {\n        return Ok(());\n    }\n\n    if !allow_stash {\n        bail!(\"working tree has uncommitted changes; commit/stash them or rerun with --stash\");\n    }\n","sourceCodeStart":216,"sourceCodeEnd":252,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/fix.rs#L216-L252","documentation":"Error \"failed to resolve git repository root\" thrown in nikivdev/code.","triggerScenarios":"Thrown at src/fix.rs:234 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}