{"record":{"id":"2008a2fff338c8c6","repo":"jenkinsci/jenkins","slug":"failed-to-refresh-extensions-after-installing-some","errorCode":null,"errorMessage":"Failed to refresh extensions after installing some plugins","messagePattern":"Failed to refresh extensions after installing some plugins","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/hudson/PluginManager.java","lineNumber":1020,"sourceCode":"            }\n            for (Dependency d : depender.getOptionalDependencies()) {\n                PluginWrapper dependee = pluginsByName.get(d.shortName);\n                if (dependee != null) {\n                    // this plugin depends on the newly loaded one!\n                    // recalculate dependencies!\n                    getPluginStrategy().updateDependency(depender, dependee);\n                    break;\n                }\n            }\n        }\n\n        // Redo who depends on who.\n        resolveDependentPlugins();\n\n        try {\n            Jenkins.get().refreshExtensions();\n        } catch (ExtensionRefreshException e) {\n            throw new IOException(\"Failed to refresh extensions after installing some plugins\", e);\n        }\n        for (PluginWrapper p : plugins) {\n            //TODO:According to the postInitialize() documentation, one may expect that\n            //p.getPluginOrFail() NPE will continue the initialization. Keeping the original behavior ATM\n          p.getPluginOrFail().postInitialize();\n        }\n\n        // run initializers in the added plugins\n        Reactor r = new Reactor(InitMilestone.ordering());\n        Set<ClassLoader> loaders = plugins.stream().map(p -> p.classLoader).collect(Collectors.toSet());\n        r.addAll(new InitializerFinder(uberClassLoader) {\n          @Override\n          protected boolean filter(Method e) {\n            return !loaders.contains(e.getDeclaringClass().getClassLoader()) || super.filter(e);\n          }\n        }.discoverTasks(r));\n        new InitReactorRunner().run(r);\n      }","sourceCodeStart":1002,"sourceCodeEnd":1038,"githubUrl":"https://github.com/jenkinsci/jenkins/blob/2e228ff40b14dbc8b14ffbc6edf0e4383cf744fc/core/src/main/java/hudson/PluginManager.java#L1002-L1038","documentation":"Thrown when Jenkins.get().refreshExtensions() fails with ExtensionRefreshException during plugin batch startup. This means newly installed plugins' extension components could not be registered — typically because of classloader conflicts, missing extension points, or @Extension-annotated classes that fail to instantiate. The original ExtensionRefreshException is wrapped.","triggerScenarios":"After batch-installing plugins, calling refreshExtensions() encounters a component that cannot be loaded — class not found, incompatible API, or a constructor that throws.","commonSituations":"Installing a plugin that depends on an extension point API version not present in the running Jenkins, or a plugin whose @Extension classes have unsatisfied dependencies at instantiation time.","solutions":["Examine the wrapped ExtensionRefreshException for which extension/component failed.","Ensure all transitive plugin dependencies are installed and version-compatible.","Upgrade Jenkins core to a version that supports the plugin's required extension APIs.","Remove the conflicting plugin and retry the batch install."],"exampleFix":"// No direct application-level fix; the cause is in plugin/extension compatibility.\n// Inspect logs:\n// e.getCause() -> ExtensionRefreshException with component details","handlingStrategy":"try-catch","validationCode":"// Pre-check: ensure all dependencies are installed and compatible\nfor (PluginWrapper.Dependency dep : p.getDependencies()) {\n    PluginWrapper resolved = pluginManager.getPlugin(dep.shortName);\n    if (resolved == null || (dep.version != null && resolved.getVersion().compareTo(new VersionNumber(dep.version)) < 0)) {\n        throw new IllegalStateException(\"Missing or incompatible dependency: \" + dep.shortName);\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    pluginManager.start(pluginsToStart);\n} catch (IOException e) {\n    if (e.getCause() instanceof ExtensionRefreshException) {\n        ExtensionRefreshException ere = (ExtensionRefreshException) e.getCause();\n        listener.error(\"Extension refresh failed: \" + ere.getMessage());\n        // The problematic extension/component info is in ere\n    } else {\n        throw e;\n    }\n}","preventionTips":["Verify all transitive plugin dependencies are installed and version-compatible before batch start.","Upgrade Jenkins core to match plugin extension API requirements.","Test plugin batches on a staging instance before production."],"tags":["plugin-manager","extensions","classloader","batch-install"],"backgroundTag":null,"analyzedSha":"2e228ff40b14dbc8b14ffbc6edf0e4383cf744fc","analyzedAt":"2026-08-14T07:07:15.274Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}