junit-team/junit5 · error · UncheckedIOException
Failed to start process
Error message
Failed to start process
What it means
Thrown by GitInfoCollector.ProcessExecutor.startProcess() as an UncheckedIOException when ProcessBuilder.start() raises IOException. Occurs when the 'git' executable (or whichever command) cannot be launched - typically git not on PATH, the working directory is invalid, or the OS refused process creation.
Source
Thrown at junit-platform-reporting/src/main/java/org/junit/platform/reporting/open/xml/GitInfoCollector.java:171
catch (IOException ignore) {
return Optional.empty();
}
finally {
process.destroyForcibly();
}
}
private static BufferedReader newBufferedReader(InputStream stream) {
return new BufferedReader(new InputStreamReader(stream, Charset.defaultCharset()));
}
private Process startProcess(String[] command) {
Process process;
try {
process = new ProcessBuilder().directory(workingDir.toFile()).command(command).start();
}
catch (IOException e) {
throw new UncheckedIOException("Failed to start process", e);
}
return process;
}
private static void readAllChars(Reader reader, BiConsumer<char[], Integer> consumer) throws IOException {
char[] buffer = new char[1024];
int numChars;
while ((numChars = reader.read(buffer)) != -1) {
consumer.accept(buffer, numChars);
}
}
private static String trimAtEnd(StringBuilder value) {
int endIndex = value.length();
for (int i = value.length() - 1; i >= 0; i--) {
if (Character.isWhitespace(value.charAt(i))) {
endIndex--;
break;View on GitHub (pinned to 956246301e)
Solutions
- Install git on the PATH of the environment running tests, or
- Disable git info collection: set junit.platform.reporting.open.xml.git.enabled=false.
- Ensure the JVM's working directory exists and is readable.
- Verify the PATH environment variable is inherited by the test process.
Example fix
# before (junit-platform.properties) junit.platform.reporting.open.xml.git.enabled = true # git missing -> UncheckedIOException # after junit.platform.reporting.open.xml.git.enabled = false
Defensive patterns
Strategy: validation
Validate before calling
// Disable git collection when git is unavailable
boolean gitPresent = Arrays.stream(System.getenv("PATH").split(File.pathSeparator))
.anyMatch(p -> new File(p, "git").canExecute());
if (!gitPresent) System.setProperty("junit.platform.reporting.open.xml.git.enabled", "false"); Type guard
static boolean gitAvailable() {
try { new ProcessBuilder("git","--version").start().waitFor(); return true; }
catch (Exception e) { return false; }
} Try / catch
try {
GitInfoCollector.get(workingDir);
} catch (UncheckedIOException e) {
// disable git reporting and continue
} Prevention
- Install git in CI images that enable git reporting, or keep the property disabled.
- Inherit PATH into the test JVM so ProcessBuilder can resolve 'git'.
- For distroless images, set junit.platform.reporting.open.xml.git.enabled=false.
When it happens
Trigger: OpenTestReportGeneratingListener with junit.platform.reporting.open.xml.git.enabled=true triggers GitInfoCollector.get(), which calls executor.exec('git', '--version'). startProcess() throws if git is not installed or the working directory does not exist. Note: the 'is git installed' probe itself throws rather than returning empty when start() fails.
Common situations: CI image without git installed. Working directory deleted/changed before report generation. Minimal Docker images (distroless) lacking git. PATH not propagated to the test JVM.
Related errors
- Failed to create XML events file
- Failed to close XML events file
- Could not read color palette properties
- Could not open color palette properties file
- Failed to retrieve canonical path for file: ${file}
AI-assisted analysis of junit-team/junit5@956246301e (2026-08-04).
Data as JSON: /data/errors/49342fa6b269c3d5.json.
Report an issue: GitHub.