quarkusio/quarkus · error · IllegalStateException
Cannot reset a started application
Error message
Cannot reset a started application
What it means
ApplicationStateNotification tracks global dev-mode application state. reset() restores the INITIAL state between (re)deployments, but resetting an application that is currently STARTED would corrupt lifecycle tracking, so it is rejected with this IllegalStateException.
Source
Thrown at core/devmode-spi/src/main/java/io/quarkus/dev/appstate/ApplicationStateNotification.java:20
/**
* A class that allows for access to the application state, even from outside the runtime class loader.
*
* This should generally only be used by dev mode internals that need information about the current
* application state.
*
* This class makes no attempt to verify that an application is starting/stopping when the
* wait methods are called, this should only be called by a client that is controlling the Quarkus
* lifecycle, and so knows what the current lifecycle state is.
*/
public class ApplicationStateNotification {
private static State state = State.INITIAL;
private static Throwable startupProblem;
public static synchronized void reset() {
if (state == State.STARTED) {
throw new IllegalStateException("Cannot reset a started application");
}
state = State.INITIAL;
startupProblem = null;
}
public static synchronized void notifyStartupComplete() {
state = State.STARTED;
ApplicationStateNotification.class.notifyAll();
}
public static synchronized void notifyApplicationStopped() {
state = State.STOPPED;
ApplicationStateNotification.class.notifyAll();
}
/**
* Notify of startup failure.
*View on GitHub (pinned to e1c734241f)
Solutions
- Stop/shut down the running application before calling reset()
- Use ApplicationStateNotification.waitForApplicationState(...) to confirm the app left STARTED state before resetting
- Restructure restart logic to go through the framework's redeploy path instead of manual reset
- Guard reset() behind a state check if you control the caller
Example fix
// before ApplicationStateNotification.reset(); // throws if STARTED // after ApplicationStateNotification.waitForApplicationState(Duration.ofSeconds(10), State.STOPPED); ApplicationStateNotification.reset();
Defensive patterns
Strategy: validation
Validate before calling
// before reset
State s = ApplicationStateNotification.waitForApplicationState(Duration.ZERO, State.STOPPED, State.INITIAL);
if (s == State.STARTED) { /* stop application first */ } Try / catch
try { ApplicationStateNotification.reset(); } catch (IllegalStateException e) { if (e.getMessage().contains("Cannot reset a started application")) { /* shut down app, then reset */ } else { throw e; } } Prevention
- Always stop the application before resetting state
- Use waitForApplicationState to synchronize on state transitions
- Prefer the framework redeploy path over manual reset
When it happens
Trigger: Calling ApplicationStateNotification.reset() while state == State.STARTED — e.g. a dev tool attempting to reset state without first stopping the running application, or a lifecycle race where restart logic runs before shutdown notification completes.
Common situations: Custom dev-mode tooling resetting state between hot reloads while the old instance still runs; test harnesses reusing state helpers across started applications.
Related errors
- Unable to deserialize the dev mode context. Does the Quarkus
- Hot deployment of the application is not supported when upda
- remote-dev can only be used with mutable applications i.e. u
- Failed to create compiler
- Failed to open class path file <file>
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/5ac031c21155d2b3.
Report an issue: GitHub.