{"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/5b2dbdbb8be64415eb6552f81ff7c449c8d251e6/build-plugin/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/JavaProcessExecutor.java#L62-L98","documentation":"Thrown by JavaProcessExecutor.run (the synchronous run method) as a MojoExecutionException wrapping an IOException raised by RunProcess.run(true, ...). This represents a failure to start or communicate with the forked JVM itself, not the JVM exiting with a non-zero status (that is error 32). Common IOException sources here are missing java executable, broken pipe to the child, or inability to spawn the process.","triggerScenarios":"The java executable resolved by JavaProcessExecutor.getJavaExecutable() does not exist or is not executable; the working directory does not exist; the OS refuses to spawn the process (too many open files, permissions); the toolchain-configured JDK path is broken; RunProcess loses its pipe to the child.","commonSituations":"A configured Maven toolchain points at a JDK that was since uninstalled; running in a container where /usr/bin/java is missing; ulimit exhaustion (EMFILE); the workingDirectory parameter points at a non-existent folder; PATH issues after a JDK upgrade.","solutions":["Verify the java on PATH runs: `java -version`.","If using Maven toolchains, check ~/.m2/toolchains.xml points at an existing JDK.","Confirm spring-boot.run.workingDirectory exists and is a directory.","Inspect the wrapped IOException message — it usually names the missing executable or the OS error."],"exampleFix":"// before — toolchains.xml references a removed JDK\n<toolchain>\n  <type>jdk</type>\n  <provides><version>17</version></provides>\n  <configuration><jdkHome>/opt/jdk-17</jdkHome></configuration>\n</toolchain>\n// after — existing JDK home\n<jdkHome>/usr/lib/jvm/java-17-openjdk</jdkHome>","handlingStrategy":"validation","validationCode":"// Confirm java is on PATH / toolchain before running\nimport java.io.File;\n\nvoid ensureJava(String toolchainJavaHome) {\n    File java = (toolchainJavaHome != null)\n        ? new File(toolchainJavaHome, \"bin/java\")\n        : new File(\"/usr/bin/java\"); // or use which-equivalent\n    if (!java.canExecute()) throw new IllegalStateException(\"java not executable: \" + java);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Verify toolchains.xml points at an existing JDK after any JDK upgrade/uninstall.","Ensure spring-boot.run.workingDirectory exists before invoking run.","Run `java -version` in CI to catch PATH issues early."],"tags":["maven","spring-boot","run","process","io"],"analyzedSha":"5b2dbdbb8be64415eb6552f81ff7c449c8d251e6","analyzedAt":"2026-08-04T18:53:14.967Z","schemaVersion":2}