jenkinsci/jenkins · warning · RestartNotSupportedException

Restart is not supported in this running mode ({getClass().g

Error message

Restart is not supported in this running mode ({getClass().getName()}).

What it means

Thrown by the default Lifecycle.verifyRestartable() when the restart() method has NOT been overridden by the concrete Lifecycle subclass. It uses Util.isOverridden to check whether the subclass provides a real restart implementation; if not, restart is unsupported in that running mode. The message includes the actual class name so the operator knows which Lifecycle is active.

Source

Thrown at core/src/main/java/hudson/lifecycle/Lifecycle.java:227

     * case this method will successfully return.)
     *
     * <p>
     * Throw an exception if the operation fails unexpectedly.
     */
    public void restart() throws IOException, InterruptedException {
        throw new UnsupportedOperationException();
    }

    /**
     * Can the {@link #restart()} method restart Hudson?
     *
     * @throws RestartNotSupportedException
     *      If the restart is not supported, throw this exception and explain the cause.
     */
    public void verifyRestartable() throws RestartNotSupportedException {
        // the rewriteHudsonWar method isn't overridden.
        if (!Util.isOverridden(Lifecycle.class, getClass(), "restart"))
            throw new RestartNotSupportedException("Restart is not supported in this running mode (" +
                    getClass().getName() + ").");
    }

    /**
     * The same as {@link #verifyRestartable()} except the status is indicated by the return value,
     * not by an exception.
     */
    public boolean canRestart() {
        try {
            verifyRestartable();
            return true;
        } catch (RestartNotSupportedException e) {
            return false;
        }
    }

    /**
     * Called when Jenkins startup is finished or when Jenkins has finished reloading its

View on GitHub (pinned to 2e228ff40b)

Solutions

  1. If you wrote a custom Lifecycle, override the restart() method to provide a real restart implementation
  2. Before calling restart, check Lifecycle.get().canRestart() and present a graceful 'not supported' message to users
  3. Use a supported lifecycle (Windows service, systemd, SMF) so restart() is overridden
  4. Catch RestartNotSupportedException at the UI/CLI layer and inform the user instead of failing

Example fix

// before
Lifecycle.get().restart();
// after
Lifecycle lc = Lifecycle.get();
if (!lc.canRestart()) {
    throw new IllegalStateException("Restart unsupported with lifecycle " + lc.getClass().getName());
}
lc.restart();
Defensive patterns

Strategy: validation

Validate before calling

if (!Lifecycle.get().canRestart()) {
    // do not offer restart; show 'unsupported' message
    return;
}

Try / catch

try {
    Lifecycle.get().verifyRestartable();
} catch (RestartNotSupportedException e) {
    // inform user that restart is not supported for lifecycle: included in message
}

Prevention

When it happens

Trigger: verifyRestartable() is called on a Lifecycle subclass that does not override restart() — e.g. the default no-op Lifecycle, or a custom Lifecycle that only overrides rewriteHudsonWar but not restart. Triggered by the Restart button, CLI restart command, or any plugin calling Lifecycle.get().verifyRestartable().

Common situations: A custom Lifecycle implementation that forgot to override restart(); running in an embedded/test mode where the default Lifecycle is installed; a plugin or core path that calls restart without first checking canRestart().

Related errors


AI-assisted analysis of jenkinsci/jenkins@2e228ff40b (2026-08-14). Data as JSON: /api/errors/e04111ad06070f3c. Report an issue: GitHub.