quarkusio/quarkus · error · IllegalStateException
Tests already in progress
Error message
Tests already in progress
What it means
ModuleTestRunner.prepare throws IllegalStateException 'Tests already in progress' when a test run is requested while a previous runner instance is still active in the same synchronized block. Quarkus dev mode allows only one continuous-testing run at a time per module.
Source
Thrown at core/deployment/src/main/java/io/quarkus/deployment/dev/testing/ModuleTestRunner.java:66
log.debug("Exception while aborting runner during reset", e);
}
runner = null;
}
}
Runnable prepare(ClassScanResult classScanResult, boolean reRunFailures, long runId, TestRunListener listener) {
return prepare(classScanResult, reRunFailures, runId, listener, null);
}
Runnable prepare(ClassScanResult classScanResult, boolean reRunFailures, long runId, TestRunListener listener,
String specificSelection) {
var old = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(testApplication.getOrCreateAugmentClassLoader());
try {
synchronized (this) {
if (runner != null) {
throw new IllegalStateException("Tests already in progress");
}
JunitTestRunner.Builder builder = new JunitTestRunner.Builder()
.setClassScanResult(classScanResult)
.setRunId(runId)
.setTestState(testState)
.setTestClassUsages(testClassUsages)
.setTestApplication(testApplication)
.setIncludeTags(testSupport.includeTags)
.setExcludeTags(testSupport.excludeTags)
.setInclude(testSupport.include)
.setExclude(testSupport.exclude)
.setSpecificSelection(specificSelection != null ? specificSelection : testSupport.specificSelection)
.setIncludeEngines(testSupport.includeEngines)
.setExcludeEngines(testSupport.excludeEngines)
.setTestType(testSupport.testType)
.setModuleInfo(moduleInfo)
.addListener(listener)
.setFailingTestsOnly(classScanResult != null && testSupport.brokenOnlyMode); //broken only mode is only when changes are made, not for forced runsView on GitHub (pinned to e1c734241f)
Solutions
- Wait for the current test run to finish before triggering another; avoid rapid re-saves
- Stop and restart quarkus:dev if a previous run appears stuck
- Ensure only one client (IDE or terminal) drives continuous testing
- Report if reproducible — a run that never clears 'runner' indicates a lifecycle bug in the test runner
Example fix
// before: test paused at breakpoint, retriggers pile up // after: resume/stop the paused run, or disable continuous testing mvn quarkus:dev -Dquarkus.test.continuous-testing=disabled
Defensive patterns
Strategy: validation
Validate before calling
if (runnerActive) {
throw new IllegalStateException("Skip trigger: a test run is already in progress");
} // or simply wait for the completed future before calling prepare again Type guard
static boolean canStartRun(ModuleTestRunner r) {
synchronized (r) { return r.hasActiveRunner(); } // expose/track an active flag before prepare()
} Try / catch
try {
testRunner.prepare(ctx, runId);
} catch (IllegalStateException e) {
if ("Tests already in progress".equals(e.getMessage())) {
// debounce: skip this trigger and let the current run finish
return;
}
throw e;
} Prevention
- Debounce file-change triggers so one run completes before the next starts
- Don't drive continuous testing from both IDE and CLI simultaneously
- Unpause stuck breakpoints promptly; restart dev mode if a run never finishes
When it happens
Trigger: Calling prepare() when the field 'runner' is non-null — i.e. a prior JUnit test run has not completed or was never marked finished, and another run (e.g. triggered by file change + test trigger) arrives concurrently.
Common situations: Continuous testing retriggered rapidly (save storms, all-files trigger) overlapping a slow previous run; paused/deadlocked test holding the runner; IDE and CLI both driving continuous testing.
Related errors
- Failed to create compiler
- The application is stopping
- className parameter is required
- Should be virtual server channel:
- A test method annotated with @TestReactiveTransaction must a
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/b348436657cabfeb.
Report an issue: GitHub.