{"record":{"id":"136aa839d649f1b3","repo":"quarkusio/quarkus","slug":"the-s-command-exited-with-an-error-s","errorCode":null,"errorMessage":"The %s command exited with an error. %s","messagePattern":"The (.+?) command exited with an error\\. (.+?)","errorType":"exception","errorClass":"QuarkusUpdateException","httpStatus":null,"severity":"error","filePath":"independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/project/update/rewrite/QuarkusUpdateCommand.java","lineNumber":272,"sourceCode":"            } else {\n                pb.output().consumeLinesWith(8192, line -> {\n                    LogLevel logLevel = LogLevel.of(line).orElse(LogLevel.UNKNOWN);\n                    switch (logLevel) {\n                        case ERROR -> log.error(logLevel.clean(line));\n                        case WARNING -> log.warn(logLevel.clean(line));\n                        case INFO -> log.info(logLevel.clean(line));\n                        default -> log.info(line);\n                    }\n                });\n                pb.error().consumeLinesWith(8192, log::error);\n                try {\n                    pb.run();\n                } finally {\n                    log.info(\"\");\n                }\n            }\n        } catch (Exception e) {\n            throw new QuarkusUpdateException(\"The %s command exited with an error. %s\".formatted(name, logInfo), e);\n        }\n    }\n\n    private static List<String> prepareCommand(List<String> command) {\n        final List<String> effectiveCommand = new ArrayList<>(command);\n        propagateSystemPropertyIfSet(\"maven.repo.local\", effectiveCommand);\n        return effectiveCommand;\n    }\n\n    static String findMvnBinary(Path baseDir) {\n        Path mavenCmd = findWrapperOrBinary(baseDir, \"mvnw\", \"mvn\");\n        if (mavenCmd == null) {\n            throw new QuarkusUpdateException(\"Cannot locate mvnw or mvn\"\n                    + \". Make sure mvnw is in the project directory or mvn is in your PATH.\");\n        }\n        return mavenCmd.toString();\n    }\n","sourceCodeStart":254,"sourceCodeEnd":290,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/project/update/rewrite/QuarkusUpdateCommand.java#L254-L290","documentation":"execute() launches the prepared Maven or Gradle rewrite process in the project directory, streaming its output to the log. If the process run throws (non-zero exit surfaced via ProcessBuilder.run, or an I/O error), it is wrapped in QuarkusUpdateException: \"The %s command exited with an error. %s\" with the command name and the captured log info (or the log file location).","triggerScenarios":"QuarkusUpdateCommand.handle() -> runMavenUpdate/runGradleUpdate -> executeRewrite -> execute(), when the spawned `mvnw ... rewrite:run|dryRun` or `gradlew ... rewriteRun|rewriteDryRun` process exits non-zero: build compilation errors, unresolvable OpenRewrite plugin/recipe dependencies, incompatible Maven/Gradle versions, or process I/O failures.","commonSituations":"Corporate proxy/firewall blocking downloads of org.openrewrite artifacts; project in a broken state before migration (does not compile); running the update on a Windows machine where the wrapper script resolution or process invocation fails; JVM crashes of the spawned build.","solutions":["Inspect the command output above the exception (or the --log-file produced by the update command) for the real build/recipe failure.","Confirm the underlying build works standalone: `mvnw verify` or `gradlew build` before running the update.","Check Maven/Gradle proxy and repository settings (settings.xml, gradle.properties) so OpenRewrite plugin and recipe artifacts can be downloaded.","Re-run with --dry-run to preview changes and surface recipe errors without modifying sources.","If a Windows-specific process error appears, run from a shell where mvnw.cmd/gradlew.bat resolves correctly, or update the Quarkus CLI."],"exampleFix":"// before: rewrite run fails mid-build\n$ quarkus update\nQuarkusUpdateException: The OpenRewrite 5.x command exited with an error.\n\n// after: verify the build is healthy and use dry-run first\n$ ./mvnw -DskipTests compile\n$ quarkus update --dry-run\n$ quarkus update","handlingStrategy":"try-catch","validationCode":"import java.nio.file.*;\n\n// Verify the underlying build is healthy before running the rewrite commands\nstatic void assertBuildHealthy(Path baseDir, boolean maven) throws IOException, InterruptedException {\n    Process p = maven\n        ? new ProcessBuilder(\"./mvnw\", \"-q\", \"-DskipTests\", \"compile\")\n        : new ProcessBuilder(\"./gradlew\", \"-q\", \"compileJava\")\n            .directory(baseDir.toFile()).inheritIO().start();\n    if (p.waitFor() != 0) {\n        throw new IllegalStateException(\"Build must succeed before running the update\");\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    QuarkusUpdateCommand.handle(log, buildTool, baseDir, rewritePluginVersion, recipesGAV, recipe, logFile, dryRun);\n} catch (QuarkusUpdateException e) {\n    String msg = e.getMessage(); // \"The <name> command exited with an error. <logInfo>\"\n    log.error(\"Rewrite process failed: %s%nCause: %s\", msg,\n        e.getCause() != null ? e.getCause().toString() : \"see logs above\");\n}","preventionTips":["Run the equivalent Maven/Gradle build command successfully before attempting the update.","Do a `--dry-run` update first to catch recipe/plugin resolution errors without mutating sources.","Check proxy/repository configuration (settings.xml, gradle.properties) so OpenRewrite dependencies resolve.","Run the command from the project root directory, not a subdirectory, so wrapper and relative paths resolve."],"tags":["process-execution","maven","gradle","openrewrite","update-command"],"backgroundTag":"build-command-exited-with-error","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-15T02:17:10.978Z"}