{"record":{"id":"0908c8394c7dc2fc","repo":"spring-projects/spring-boot","slug":"process-execution-failed","errorCode":null,"errorMessage":"Process execution failed","messagePattern":"Process execution failed","errorType":"exception","errorClass":"MojoExecutionException","httpStatus":null,"severity":"error","filePath":"build-plugin/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/JavaProcessExecutor.java","lineNumber":80,"sourceCode":"\t\t\t\t? this.runProcessCustomizer.andThen(customizer) : customizer;\n\t\treturn new JavaProcessExecutor(this.mavenSession, this.toolchainManager, combinedCustomizer);\n\t}\n\n\tint run(File workingDirectory, List<String> args, Map<String, String> environmentVariables)\n\t\t\tthrows MojoExecutionException {\n\t\tRunProcess runProcess = new RunProcess(workingDirectory, getJavaExecutable());\n\t\tif (this.runProcessCustomizer != null) {\n\t\t\tthis.runProcessCustomizer.accept(runProcess);\n\t\t}\n\t\ttry {\n\t\t\tint exitCode = runProcess.run(true, args, environmentVariables);\n\t\t\tif (!hasTerminatedSuccessfully(exitCode)) {\n\t\t\t\tthrow new MojoExecutionException(\"Process terminated with exit code: \" + exitCode);\n\t\t\t}\n\t\t\treturn exitCode;\n\t\t}\n\t\tcatch (IOException ex) {\n\t\t\tthrow new MojoExecutionException(\"Process execution failed\", ex);\n\t\t}\n\t}\n\n\tRunProcess runAsync(File workingDirectory, List<String> args, Map<String, String> environmentVariables)\n\t\t\tthrows MojoExecutionException {\n\t\ttry {\n\t\t\tRunProcess runProcess = new RunProcess(workingDirectory, getJavaExecutable());\n\t\t\trunProcess.run(false, args, environmentVariables);\n\t\t\treturn runProcess;\n\t\t}\n\t\tcatch (IOException ex) {\n\t\t\tthrow new MojoExecutionException(\"Process execution failed\", ex);\n\t\t}\n\t}\n\n\tprivate boolean hasTerminatedSuccessfully(int exitCode) {\n\t\treturn (exitCode == 0 || exitCode == EXIT_CODE_SIGINT);\n\t}","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/spring-projects/spring-boot/blob/270dfe353fb830fd69b823a8a859287ff103854b/build-plugin/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/JavaProcessExecutor.java#L62-L98","documentation":"MojoExecutionException thrown by the synchronous JavaProcessExecutor.run path when RunProcess.run throws an IOException — i.e., the process could not be launched or its I/O streams failed, distinct from a clean non-zero exit (which is the sibling message above). The original IOException is chained.","triggerScenarios":"IOException from RunProcess.run(true, ...) when starting or communicating with the forked JVM: java executable missing, working directory inaccessible, broken pipe on stdout/stderr, or environment setup failure.","commonSituations":"Toolchain points to a non-existent JAVA_HOME; workingDirectory doesn't exist or isn't writable; too-long command line on Windows hitting Process limits; antivirus blocking the fork; environment variables contain invalid values for the platform.","solutions":["Inspect the chained IOException — `Cannot run program ...` typically indicates a missing/invalid java executable.","Verify the configured toolchain JDK is installed and `java -version` works from that path.","Ensure the working directory exists and is writable by the Maven process.","On Windows, reduce the argument count or use argfile/@-file expansion if command-line length is the issue."],"exampleFix":"// before: <toolchains><jdk><version>21</version><vendor>temurin</vendor></jdk></toolchains>  (JDK not installed at expected path)\n// after:  install Temurin 21 and re-run `mvn spring-boot:run`","handlingStrategy":"validation","validationCode":"// Pre-validate the fork launch inputs:\nFile javaHome = new File(System.getenv(\"JAVA_HOME\"));\nFile javaBin = new File(javaHome, \"bin/java\");\nif (!javaBin.canExecute()) {\n    throw new IllegalStateException(\"JAVA_HOME java not executable: \" + javaBin);\n}\nif (workingDirectory != null && !workingDirectory.isDirectory()) {\n    throw new IllegalStateException(\"Working dir missing: \" + workingDirectory);\n}","typeGuard":null,"tryCatchPattern":"try {\n    // invoke goal using JavaProcessExecutor.run\n} catch (MojoExecutionException ex) {\n    if (\"Process execution failed\".equals(ex.getMessage()) && ex.getCause() instanceof IOException) {\n        // verify toolchain/JAVA_HOME and working dir, then retry with corrected config\n    }\n    throw ex;\n}","preventionTips":["Pin a toolchain JDK and verify `java -version` in CI.","Ensure the working directory exists before forking.","On Windows, watch command-line length limits."],"tags":["spring-boot","maven-plugin","process","io","toolchain"],"backgroundTag":null,"analyzedSha":"270dfe353fb830fd69b823a8a859287ff103854b","analyzedAt":"2026-08-11T19:42:06.541Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}