{"record":{"id":"271a00b3d3507f4a","repo":"jenkinsci/jenkins","slug":"failed-to-initialize","errorCode":null,"errorMessage":"Failed to initialize","messagePattern":"Failed to initialize","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"critical","filePath":"core/src/main/java/hudson/ClassicPluginStrategy.java","lineNumber":404,"sourceCode":"                    if (!(o instanceof Plugin)) {\n                        throw new IOException(className + \" doesn't extend from hudson.Plugin\");\n                    }\n                    wrapper.setPlugin((Plugin) o);\n                } catch (LinkageError | ClassNotFoundException e) {\n                    throw new IOException(\"Unable to load \" + className + \" from \" + wrapper.getShortName(), e);\n                } catch (NoSuchMethodException | InstantiationException | IllegalAccessException | InvocationTargetException e) {\n                    throw new IOException(\"Unable to create instance of \" + className + \" from \" + wrapper.getShortName(), e);\n                }\n            }\n\n            // initialize plugin\n            try {\n                Plugin plugin = wrapper.getPluginOrFail();\n                plugin.setServletContext(pluginManager.context);\n                startPlugin(wrapper);\n            } catch (Throwable t) {\n                // gracefully handle any error in plugin.\n                throw new IOException(\"Failed to initialize\", t);\n            }\n        } finally {\n            Thread.currentThread().setContextClassLoader(old);\n        }\n    }\n\n    public void startPlugin(PluginWrapper plugin) throws Exception {\n        plugin.getPluginOrFail().start();\n    }\n\n    @Override\n    public void updateDependency(PluginWrapper depender, PluginWrapper dependee) {\n        DependencyClassLoader classLoader = findAncestorDependencyClassLoader(depender.classLoader);\n        if (classLoader != null) {\n            classLoader.updateTransitiveDependencies();\n            LOGGER.log(Level.INFO, \"Updated dependency of {0}\", depender.getShortName());\n        }\n    }","sourceCodeStart":386,"sourceCodeEnd":422,"githubUrl":"https://github.com/jenkinsci/jenkins/blob/2e228ff40b14dbc8b14ffbc6edf0e4383cf744fc/core/src/main/java/hudson/ClassicPluginStrategy.java#L386-L422","documentation":"Thrown by ClassicPluginStrategy.load(PluginWrapper) when the plugin's initialization phase fails. After the plugin class is loaded and instantiated, Jenkins sets its servlet context and calls startPlugin, which invokes Plugin.start(). The catch(Throwable) deliberately swallows everything (Errors included) and rethrows as IOException so a broken plugin aborts loading cleanly rather than killing the boot. The original cause is always attached as the exception cause.","triggerScenarios":"Plugin.start() or PluginWithContext.start() throws any Throwable; setServletContext throws; the plugin subclass overrides start() and performs DB/IO/network init that fails; a static initializer or @PostConstruct on the plugin object throws during start().","commonSituations":"Plugin upgraded to a version whose start() requires a newer Jenkins core; plugin depends on a missing/incompatible other plugin or library; plugin reads a config file that is absent or corrupt on first load; plugin connects to an external service during start() that is unreachable.","solutions":["Read the attached cause stack trace in the Jenkins log to identify which line of the plugin's start() threw.","Verify all plugin dependencies are installed at compatible versions (check the plugin's MANIFEST.MF dependencies against installed plugins).","Upgrade or downgrade the failing plugin to a version compatible with the running Jenkins core.","If you own the plugin, move risky init (network/DB) out of start() into a lazily-initialized or @PostConstruct method with try/catch, or fail soft.","Disable the plugin via the UI/cli (rename its .jpi to .jpi.disabled) to restore Jenkins boot, then diagnose."],"exampleFix":"// before\n@Override\npublic void start() throws Exception {\n    connect(); // throws if DB down -> Jenkins fails to initialize\n}\n// after\n@Override\npublic void start() {\n    try { connect(); }\n    catch (Exception e) { LOGGER.log(Level.WARNING, \"deferring connection\", e); }\n}","handlingStrategy":"try-catch","validationCode":"null","typeGuard":"null","tryCatchPattern":"try {\n    jenkins.getPluginManager().getPlugin(shortName).getPlugin().start();\n} catch (IOException e) {\n    // 'Failed to initialize' — inspect e.getCause() for the plugin's real failure\n    LOGGER.log(Level.SEVERE, \"Plugin \" + shortName + \" failed to start\", e.getCause());\n}","preventionTips":["If you write a plugin, keep Plugin.start() resilient: never let a thrown exception abort startup for non-fatal init.","Pin plugin versions compatible with your Jenkins core in the plugins.txt / install list.","Stage plugin upgrades and watch the boot log for the cause stack trace before relying on the plugin."],"tags":["plugin-loading","lifecycle","initialization"],"backgroundTag":null,"analyzedSha":"2e228ff40b14dbc8b14ffbc6edf0e4383cf744fc","analyzedAt":"2026-08-14T07:07:15.274Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}