{"record":{"id":"1ef69ea16b6911b7","repo":"nikivdev/code","slug":"git-failed-1ef69e","errorCode":null,"errorMessage":"git {} failed: {}","messagePattern":"git (.+?) failed: (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/changes.rs","lineNumber":92,"sourceCode":"    let root = String::from_utf8_lossy(&output.stdout).trim().to_string();\n    if root.is_empty() {\n        bail!(\"Unable to resolve git root.\");\n    }\n    trace(&format!(\"repo root: {}\", root));\n    Ok(PathBuf::from(root))\n}\n\nfn git_output_in(repo_root: &Path, args: &[&str]) -> Result<(String, bool)> {\n    let output = Command::new(\"git\")\n        .current_dir(repo_root)\n        .args(args)\n        .output()\n        .with_context(|| format!(\"failed to run git {}\", args.join(\" \")))?;\n    let stdout = String::from_utf8_lossy(&output.stdout).to_string();\n    let stderr = String::from_utf8_lossy(&output.stderr).to_string();\n    let ok = output.status.success();\n    if !ok && stdout.is_empty() {\n        bail!(\"git {} failed: {}\", args.join(\" \"), stderr.trim());\n    }\n    Ok((stdout, ok))\n}\n\nfn git_ref_exists(repo_root: &Path, reference: &str) -> Result<bool> {\n    let full_ref = format!(\"{}^{{commit}}\", reference);\n    let output = Command::new(\"git\")\n        .current_dir(repo_root)\n        .args([\"rev-parse\", \"--verify\", &full_ref])\n        .output()\n        .with_context(|| format!(\"failed to verify git ref {}\", reference))?;\n    Ok(output.status.success())\n}\n\nfn resolve_base_ref(repo_root: &Path) -> Result<String> {\n    let candidates = [\"main\", \"origin/main\", \"master\", \"origin/master\"];\n    for candidate in candidates {\n        if git_ref_exists(repo_root, candidate)? {","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/changes.rs#L74-L110","documentation":"Error \"git {} failed: {}\" thrown in nikivdev/code.","triggerScenarios":"Thrown at src/changes.rs:92 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"}