{"record":{"id":"69b47be81b9c0022","repo":"Hmbown/CodeWhale","slug":"git-not-found","errorCode":null,"errorMessage":"git not found","messagePattern":"git not found","errorType":"exception","errorClass":"io::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/tools/tasks.rs","lineNumber":875,"sourceCode":"            .task_manager\n            .as_ref()\n            .ok_or_else(|| ToolError::not_available(\"TaskManager is not attached\"))?;\n        let task = read_task_for_input(input, context).await?;\n        let attempt_id = required_str(input, \"attempt_id\")?;\n        let attempt = task\n            .attempts\n            .iter()\n            .find(|attempt| attempt.id == attempt_id)\n            .ok_or_else(|| ToolError::invalid_input(format!(\"Attempt not found: {attempt_id}\")))?;\n        let patch_ref = attempt\n            .patch_path\n            .as_ref()\n            .ok_or_else(|| ToolError::invalid_input(\"Attempt has no patch artifact\"))?;\n        let patch_path = manager.artifact_absolute_path(patch_ref);\n        let workspace = context.workspace.clone();\n        let out = tokio::task::spawn_blocking(move || {\n            crate::dependencies::Git::command()\n                .ok_or_else(|| std::io::Error::new(std::io::ErrorKind::NotFound, \"git not found\"))?\n                .args([\"apply\", \"--check\"])\n                .arg(&patch_path)\n                .current_dir(&workspace)\n                .output()\n        })\n        .await\n        .map_err(|join_err| {\n            // Surface the otherwise-discarded join error for debugging; the\n            // returned ToolError (and thus user-facing behavior) is unchanged.\n            tracing::debug!(error = %join_err, \"git apply --check spawn_blocking task failed to join\");\n            ToolError::execution_failed(format!(\"git apply --check panicked: {join_err}\"))\n        })?\n        .map_err(|e| ToolError::execution_failed(format!(\"git apply --check failed: {e}\")))?;\n        let stdout = String::from_utf8_lossy(&out.stdout).to_string();\n        let stderr = String::from_utf8_lossy(&out.stderr).to_string();\n        ToolResult::json(&json!({\n            \"attempt_id\": attempt_id,\n            \"patch_path\": patch_ref,","sourceCodeStart":857,"sourceCodeEnd":893,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/tools/tasks.rs#L857-L893","documentation":"execute_pr_attempt_preflight runs `git apply --check` inside spawn_blocking to validate a patch artifact before applying it. It resolves git via crate::dependencies::Git::command(); when no git executable is on PATH it returns a ToolError wrapping io::ErrorKind::NotFound with \"git not found\". The PR attempt cannot be validated without git.","triggerScenarios":"Executing the tasks tool's PR attempt flow (execute -> execute_pr_attempt_preflight) while the environment lacks a git binary; Git::command() returns None inside the spawn_blocking closure.","commonSituations":"Running in a container image without git; GUI-launched app with a stripped PATH; CI runner missing git in a distroless/minimal image.","solutions":["Install git in the execution environment (`apt install git`, `apk add git`).","Launch from a shell where `which git` resolves, or fix PATH in the launcher/service environment.","If git is at a custom path, prepend its bin directory to PATH.","Optionally preflight git availability at tool startup and return a clearer setup-oriented ToolError."],"exampleFix":"// before\ndocker run --rm codewhale:slim ...  # image has no git\n// after\n# Dockerfile\nRUN apt-get update && apt-get install -y --no-install-recommends git","handlingStrategy":"fallback","validationCode":"// preflight in the execution environment\ncommand -v git >/dev/null 2>&1 || { echo \"install git to use PR attempts\" >&2; exit 127; }","typeGuard":null,"tryCatchPattern":"// rust\nmatch execute_pr_attempt_preflight(...) {\n    Err(e) if e.to_string().contains(\"git not found\") => {\n        eprintln!(\"git missing from PATH; install git or fix PATH and retry\");\n    }\n    other => other?,\n}","preventionTips":["Include git in container images and CI runners that execute PR attempts.","Preflight git availability when the tasks tool initializes.","Launch from shells with complete PATH; fix stripped PATH in GUI/service launchers."],"tags":["git","path","environment","patch"],"backgroundTag":"command-not-found","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}