{"record":{"id":"e04111ad06070f3c","repo":"jenkinsci/jenkins","slug":"restart-is-not-supported-in-this-running-mode-ge","errorCode":null,"errorMessage":"Restart is not supported in this running mode ({getClass().getName()}).","messagePattern":"Restart is not supported in this running mode \\((.+?)\\)\\.","errorType":"exception","errorClass":"RestartNotSupportedException","httpStatus":null,"severity":"warning","filePath":"core/src/main/java/hudson/lifecycle/Lifecycle.java","lineNumber":227,"sourceCode":"     * case this method will successfully return.)\n     *\n     * <p>\n     * Throw an exception if the operation fails unexpectedly.\n     */\n    public void restart() throws IOException, InterruptedException {\n        throw new UnsupportedOperationException();\n    }\n\n    /**\n     * Can the {@link #restart()} method restart Hudson?\n     *\n     * @throws RestartNotSupportedException\n     *      If the restart is not supported, throw this exception and explain the cause.\n     */\n    public void verifyRestartable() throws RestartNotSupportedException {\n        // the rewriteHudsonWar method isn't overridden.\n        if (!Util.isOverridden(Lifecycle.class, getClass(), \"restart\"))\n            throw new RestartNotSupportedException(\"Restart is not supported in this running mode (\" +\n                    getClass().getName() + \").\");\n    }\n\n    /**\n     * The same as {@link #verifyRestartable()} except the status is indicated by the return value,\n     * not by an exception.\n     */\n    public boolean canRestart() {\n        try {\n            verifyRestartable();\n            return true;\n        } catch (RestartNotSupportedException e) {\n            return false;\n        }\n    }\n\n    /**\n     * Called when Jenkins startup is finished or when Jenkins has finished reloading its","sourceCodeStart":209,"sourceCodeEnd":245,"githubUrl":"https://github.com/jenkinsci/jenkins/blob/2e228ff40b14dbc8b14ffbc6edf0e4383cf744fc/core/src/main/java/hudson/lifecycle/Lifecycle.java#L209-L245","documentation":"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.","triggerScenarios":"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().","commonSituations":"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().","solutions":["If you wrote a custom Lifecycle, override the restart() method to provide a real restart implementation","Before calling restart, check Lifecycle.get().canRestart() and present a graceful 'not supported' message to users","Use a supported lifecycle (Windows service, systemd, SMF) so restart() is overridden","Catch RestartNotSupportedException at the UI/CLI layer and inform the user instead of failing"],"exampleFix":"// before\nLifecycle.get().restart();\n// after\nLifecycle lc = Lifecycle.get();\nif (!lc.canRestart()) {\n    throw new IllegalStateException(\"Restart unsupported with lifecycle \" + lc.getClass().getName());\n}\nlc.restart();","handlingStrategy":"validation","validationCode":"if (!Lifecycle.get().canRestart()) {\n    // do not offer restart; show 'unsupported' message\n    return;\n}","typeGuard":null,"tryCatchPattern":"try {\n    Lifecycle.get().verifyRestartable();\n} catch (RestartNotSupportedException e) {\n    // inform user that restart is not supported for lifecycle: included in message\n}","preventionTips":["If implementing a custom Lifecycle, override restart() to enable restart","Gate all restart-triggering UI/CLI behind canRestart() checks","Use a supported lifecycle implementation (WindowsService, Systemd, SMF, Unix)"],"tags":["lifecycle","restart","unsupported-operation","subclassing"],"backgroundTag":null,"analyzedSha":"2e228ff40b14dbc8b14ffbc6edf0e4383cf744fc","analyzedAt":"2026-08-14T07:07:15.274Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}