quarkusio/quarkus · error · RuntimeException
Should never reach this!
Error message
Should never reach this!
What it means
During quarkus:run, QuarkusRun.accept matches runnable commands contributed by installed extensions. If none matched (cmds.size()==0) and fewer than 3 commands exist in an unexpected state, it throws RuntimeException("Should never reach this!") — a defensive assertion for an internal invariant that normally cannot occur.
Source
Thrown at devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusRun.java:148
cmd = cmds.get(target);
if (cmd == null) {
exists.set(false);
return;
}
} else if (cmds.size() == 1) { // defaults to pure java run
cmd = cmds.values().iterator().next();
} else if (cmds.size() == 2) { // choose not default
for (Map.Entry<String, List> entry : cmds.entrySet()) {
if (entry.getKey().equals("java"))
continue;
cmd = entry.getValue();
break;
}
} else if (cmds.size() > 2) {
tooMany.set(cmds.keySet().stream().collect(Collectors.joining(" ")));
return;
} else {
throw new RuntimeException("Should never reach this!");
}
List<String> args = (List<String>) cmd.get(0);
if (getJvmArguments().isPresent() && !getJvmArguments().get().isEmpty()) {
args.addAll(1, getJvmArgs());
}
getLogger().info("Executing \"" + String.join(" ", args) + "\"");
Path wd = (Path) cmd.get(1);
File wdir = wd != null ? wd.toFile() : workingDirectory.get();
// this was all very touchy to get the process outputing to console and exiting cleanly
// change at your own risk
// We cannot use getProject().exec() as contrl-c is not processed correctly
// and the spawned process will not shutdown
//
// This also requires running with --no-daemon as control-c doesn't seem to trigger the shutdown hook
// this poor gradle behavior is a long known issue with gradleView on GitHub (pinned to e1c734241f)
Solutions
- Set -Dquarkus.run.target=<target> explicitly to bypass command auto-detection.
- Check installed extensions supporting quarkus:run (the 'too many' message lists them) and remove conflicting ones.
- If reproducible, report a Quarkus bug with the extension list and build.gradle — this indicates an unexpected internal state.
Example fix
// before ./gradlew quarkusRun // after (explicit target avoids detection logic) ./gradlew quarkusRun -Dquarkus.run.target=io.quarkus.example.Main
Defensive patterns
Strategy: fallback
Validate before calling
// always specify the run target to avoid auto-detection edge cases ./gradlew quarkusRun -Dquarkus.run.target=com.example.Main
Try / catch
try { runQuarkus() } catch (RuntimeException e) { if (e.message == 'Should never reach this!') { /* rerun with -Dquarkus.run.target=... ; otherwise report bug */ } } Prevention
- Set -Dquarkus.run.target explicitly when multiple extensions contribute run commands.
- Avoid exotic combinations of extensions that both provide quarkus:run commands.
- Reproduce and report internal-invariant errors upstream with the extension list.
When it happens
Trigger: The command-matching loop completes with no matching command and cmds is empty or size 1 — effectively only when extension-provided run commands are missing or an unexpected internal state occurs; also reachable as a guard alongside the 'too many commands' path.
Common situations: Bugs/edge cases in extension-contributed run commands; unusual combinations of installed extensions providing quarkus:run commands; typically a library bug rather than user error.
Understand the failure class
Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.
Related errors
- Failed to remove extensions + getExtensionsToRemove()
- Failed to run application
- %s is marked @Record but does not inject an @Recorder object
- Unknown recorder constructor parameter: %s in recorder %s
- capabilityErrors.report()
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/17b476853d532bb0.
Report an issue: GitHub.