{"record":{"id":"a3af692f406d03d0","repo":"unoplatform/uno","slug":"failed-to-start-git-process","errorCode":null,"errorMessage":"Failed to start git process.","messagePattern":"Failed to start git process\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"critical","filePath":"src/FontFallbackPreprocessor/Program.cs","lineNumber":794,"sourceCode":"\tprivate static void CheckoutBranch(string repoPath, string branch)\n\t{\n\t\tRunGit($\"-C \\\"{repoPath}\\\" checkout {branch}\");\n\t\tRunGit($\"-C \\\"{repoPath}\\\" reset --hard origin/{branch}\");\n\t}\n\n\tprivate static void RunGit(string arguments)\n\t{\n\t\tvar processStart = new ProcessStartInfo\n\t\t{\n\t\t\tFileName = \"git\",\n\t\t\tArguments = arguments,\n\t\t\tCreateNoWindow = true,\n\t\t\tUseShellExecute = false,\n\t\t\tRedirectStandardError = true,\n\t\t\tRedirectStandardOutput = true\n\t\t};\n\n\t\tusing var process = Process.Start(processStart) ?? throw new InvalidOperationException(\"Failed to start git process.\");\n\t\tprocess.WaitForExit();\n\n\t\tif (process.ExitCode != 0)\n\t\t{\n\t\t\tvar error = process.StandardError.ReadToEnd();\n\t\t\tthrow new InvalidOperationException($\"git {arguments} failed: {error}\");\n\t\t}\n\t}\n}\n","sourceCodeStart":776,"sourceCodeEnd":804,"githubUrl":"https://github.com/unoplatform/uno/blob/04183404888ea21b4e5bfa3493e8d5f15e972c3a/src/FontFallbackPreprocessor/Program.cs#L776-L804","documentation":"RunGit launches the `git` binary as a child process with UseShellExecute=false. Process.Start returns null when the OS cannot resolve or launch the executable, which this method treats as a fatal InvalidOperationException. This is the FontFallbackPreprocessor's only way to clone/fetch font fallback repos, so a null process aborts the whole preprocessing build step.","triggerScenarios":"Process.StartInfo with FileName=\"git\", UseShellExecute=false is invoked when git is not installed, not on the inherited PATH, not marked executable (Linux), or the process lacks launch permissions. Also fires in sandboxed/CI containers that omit git.","commonSituations":"Fresh dev machine or Docker image without git installed; CI runner that strips PATH; running the preprocessor under a service account whose profile doesn't source the login PATH; building inside a minimal container (alpine/musl) where git is a separate apk/apt package.","solutions":["Install git and confirm `git --version` succeeds from the same shell that runs the build.","Verify git resolves on PATH: `where git` (Windows) or `which git` (Linux/macOS) from the build's working directory.","If PATH isn't inherited, set it explicitly or pass the absolute path by editing FileName to the full git binary location.","In Docker/CI images, add git to the image (e.g. `apt-get install -y git` or `apk add git`)."],"exampleFix":"// before\nFileName = \"git\",\nUseShellExecute = false,\n\n// after — resolve full path and fail with a diagnostic before launching\nvar gitPath = Environment.GetEnvironmentVariable(\"GIT_BINARY_PATH\") ?? \"git\";\nif (!File.Exists(gitPath) && Which(gitPath) is null)\n{\n    throw new InvalidOperationException(\"git not found on PATH; install git or set GIT_BINARY_PATH.\");\n}\nFileName = gitPath,\nUseShellExecute = false,","handlingStrategy":"validation","validationCode":"// Run before invoking RunGit — fails fast with an actionable message\nstatic void EnsureGitAvailable()\n{\n    var psi = new ProcessStartInfo(\"git\", \"--version\")\n    {\n        UseShellExecute = false,\n        CreateNoWindow = true,\n        RedirectStandardOutput = true\n    };\n    try\n    {\n        using var p = Process.Start(psi);\n        p?.WaitForExit(3000);\n        if (p is null || p.ExitCode != 0)\n            throw new InvalidOperationException(\"git not found on PATH. Install git or set GIT_BINARY_PATH.\");\n    }\n    catch (Win32Exception)\n    {\n        throw new InvalidOperationException(\"git binary could not be launched (not installed / not executable).\");\n    }\n}","typeGuard":null,"tryCatchPattern":"try { EnsureGitAvailable(); RunGit(args); }\ncatch (Win32Exception ex) when (ex.NativeErrorCode == 2 /* ERROR_FILE_NOT_FOUND */)\n{ /* git missing from PATH — install or fix PATH, do not retry blindly */ throw; }","preventionTips":["Add git to the CI/Docker image explicitly (apt-get/apk install git).","Run `git --version` in the build's working directory as a preflight check.","Prefer an absolute git path from config over relying on PATH inheritance under service accounts.","Document the git requirement in the preprocessor's README/build docs."],"tags":["git","process","environment","ci","build"],"backgroundTag":null,"analyzedSha":"04183404888ea21b4e5bfa3493e8d5f15e972c3a","analyzedAt":"2026-08-13T21:08:11.651Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}