{"record":{"id":"fd8555b945396fbb","repo":"jenkinsci/jenkins","slug":"default-windows-lifecycle-does-not-support-restart","errorCode":null,"errorMessage":"Default Windows lifecycle does not support restart.","messagePattern":"Default Windows lifecycle does not support restart\\.","errorType":"exception","errorClass":"RestartNotSupportedException","httpStatus":null,"severity":"warning","filePath":"core/src/main/java/hudson/lifecycle/Lifecycle.java","lineNumber":109,"sourceCode":"                } catch (ClassNotFoundException e) {\n                    LOGGER.log(Level.FINE, e, () -> \"Failed to load \" + p + \" so will try again later\");\n                    instance = new PlaceholderLifecycle();\n                } catch (InvocationTargetException e) {\n                    Throwable t = e.getCause();\n                    switch (t) {\n                        case RuntimeException runtimeException -> throw runtimeException;\n                        case IOException ioException -> throw new UncheckedIOException(ioException);\n                        case Exception exception -> throw new RuntimeException(t);\n                        case Error error -> throw error;\n                        case null, default -> throw new Error(e);\n                    }\n                }\n            } else {\n                if (Functions.isWindows()) {\n                    instance = new Lifecycle() {\n                        @Override\n                        public void verifyRestartable() throws RestartNotSupportedException {\n                            throw new RestartNotSupportedException(\n                                    \"Default Windows lifecycle does not support restart.\");\n                        }\n                    };\n                } else if (System.getenv(\"SMF_FMRI\") != null && System.getenv(\"SMF_RESTARTER\") != null) {\n                    // when we are run by Solaris SMF, these environment variables are set.\n                    instance = new SolarisSMFLifecycle();\n                } else if (System.getenv(\"NOTIFY_SOCKET\") != null) {\n                    // When we are running under systemd with Type=notify, this environment variable is set.\n                    instance = new SystemdLifecycle();\n                } else {\n                    // if run on Unix, we can do restart\n                    try {\n                        instance = new UnixLifecycle();\n                    } catch (final Throwable t) {\n                        LOGGER.log(Level.WARNING, \"Failed to install embedded lifecycle implementation\", t);\n                        instance = new Lifecycle() {\n                            @Override\n                            public void verifyRestartable() throws RestartNotSupportedException {","sourceCodeStart":91,"sourceCodeEnd":127,"githubUrl":"https://github.com/jenkinsci/jenkins/blob/2e228ff40b14dbc8b14ffbc6edf0e4383cf744fc/core/src/main/java/hudson/lifecycle/Lifecycle.java#L91-L127","documentation":"Thrown by an anonymous Lifecycle subclass installed on Windows when no Windows-native lifecycle implementation (e.g. WindowsServiceLifecycle) is available. verifyRestartable() is overridden to always throw RestartNotSupportedException. This is the fallback path: Jenkins detected it is on Windows but could not install the WMI/service-based lifecycle, so restart via the in-process 'safe restart' is permanently disabled.","triggerScenarios":"Lifecycle.get() sets instance to this anonymous class when Functions.isWindows() is true and no other lifecycle was configured (e.g. no -Djenkins.lifecycle property pointing to a custom Lifecycle). Any code calling verifyRestartable() or restart() — such as the 'Restart' Jenkins UI button or Jenkins.restartIfNotLoaded() — triggers it.","commonSituations":"Running Jenkins via 'java -jar jenkins.war' directly on Windows without the Windows service wrapper installed; running embedded in an IDE for development; deploying on Windows in a container without service infrastructure.","solutions":["Install Jenkins as a Windows service so WindowsServiceLifecycle is used instead","Use the command-line 'java -jar jenkins.war' and perform restarts manually by stopping and restarting the process","Set a custom Lifecycle via -Djenkins.lifecycle=... if you have your own implementation","If restart is required for upgrades, shut down and restart the whole host process manually"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"Lifecycle lc = Lifecycle.get();\nif (!lc.canRestart()) {\n    // disable restart UI / inform user instead of calling restart()\n    return;\n}","typeGuard":null,"tryCatchPattern":"try {\n    Lifecycle.get().verifyRestartable();\n    Lifecycle.get().restart();\n} catch (RestartNotSupportedException e) {\n    // graceful: inform the user restart is unsupported on Windows without service\n}","preventionTips":["Install Jenkins as a Windows service for restart support","Always call canRestart() before exposing the restart button to users","Document that direct java -jar on Windows cannot restart"],"tags":["lifecycle","windows","restart","unsupported-operation"],"backgroundTag":null,"analyzedSha":"2e228ff40b14dbc8b14ffbc6edf0e4383cf744fc","analyzedAt":"2026-08-14T07:07:15.274Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}