{"record":{"id":"0b8ddc116ca1b40d","repo":"jenkinsci/jenkins","slug":"failed-to-install-0-plugin","errorCode":null,"errorMessage":"Failed to install {0} plugin","messagePattern":"Failed to install (.+?) plugin","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/hudson/PluginManager.java","lineNumber":985,"sourceCode":"            // TODO antimodular; perhaps should have a PluginListener to complement ExtensionListListener?\n            CustomClassFilter.Contributed.load();\n\n            try {\n                p.resolvePluginDependencies();\n                strategy.load(p);\n\n                if (batch != null) {\n                    batch.add(p);\n                } else {\n                    start(List.of(p));\n                }\n\n            } catch (Exception e) {\n                failedPlugins.add(new FailedPlugin(p, e));\n                activePlugins.remove(p);\n                plugins.remove(p);\n                p.releaseClassLoader();\n                throw new IOException(\"Failed to install \" + sn + \" plugin\", e);\n            }\n\n            LOGGER.log(FINE, \"Plugin {0}:{1} dynamically {2}\", new Object[] {p.getShortName(), p.getVersion(), batch != null ? \"loaded but not yet started\" : \"installed\"});\n        }\n    }\n\n    @Restricted(NoExternalUse.class)\n    public void start(List<PluginWrapper> plugins) throws Exception {\n      try (ACLContext context = ACL.as2(ACL.SYSTEM2)) {\n        Map<String, PluginWrapper> pluginsByName = plugins.stream().collect(Collectors.toMap(PluginWrapper::getShortName, p -> p));\n\n        // recalculate dependencies of plugins optionally depending the newly deployed ones.\n        for (PluginWrapper depender : this.plugins) {\n            if (plugins.contains(depender)) {\n                // skip itself.\n                continue;\n            }\n            for (Dependency d : depender.getOptionalDependencies()) {","sourceCodeStart":967,"sourceCodeEnd":1003,"githubUrl":"https://github.com/jenkinsci/jenkins/blob/2e228ff40b14dbc8b14ffbc6edf0e4383cf744fc/core/src/main/java/hudson/PluginManager.java#L967-L1003","documentation":"Wraps any exception thrown during plugin installation (strategy.createPluginWrapper, batch.add, or start) into an IOException with the plugin short name. The original cause is attached. The failed plugin is added to failedPlugins, removed from activePlugins and plugins, and its classloader is released before rethrowing.","triggerScenarios":"An exception occurs anywhere in the dynamic load pipeline: createPluginWrapper fails (corrupt archive), batch.add fails (dependency conflict), or start fails (plugin initialization error).","commonSituations":"Corrupt or incompatible .jpi/.hpi file uploaded, plugin version conflicts with existing dependencies, ClassNotFoundException during plugin initialization, or a plugin's onLoad/start method throwing.","solutions":["Inspect the wrapped cause (e.getCause()) for the specific failure reason.","Verify the plugin archive integrity (valid ZIP/HPI structure, not truncated).","Check plugin dependency compatibility against currently installed plugins.","Review Jenkins logs for the plugin's onLoad/start stack trace."],"exampleFix":"// before\ntry {\n    pluginManager.dynamicLoad(arc);\n} catch (IOException e) {\n    // generic handling\n}\n\n// after — extract root cause\ntry {\n    pluginManager.dynamicLoad(arc);\n} catch (IOException e) {\n    Throwable root = e.getCause();\n    listener.error(\"Plugin install failed: \" + root.getMessage());\n}","handlingStrategy":"try-catch","validationCode":"// Validate archive before deploying\nif (!fileName.endsWith(\".jpi\") && !fileName.endsWith(\".hpi\")) {\n    throw new IllegalArgumentException(\"Not a valid plugin archive: \" + fileName);\n}\ntry (JarFile jf = new JarFile(arc)) {\n    if (jf.getManifest() == null) {\n        throw new IllegalArgumentException(\"Plugin archive has no manifest.\");\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    pluginManager.dynamicLoad(arc);\n} catch (IOException e) {\n    Throwable cause = e.getCause();\n    listener.error(\"Failed to install \" + sn + \": \" + cause.getClass().getSimpleName() + \": \" + cause.getMessage());\n    // optionally: pluginManager.getFailedPlugins() for diagnostics\n}","preventionTips":["Validate plugin archive integrity (valid JAR/HPI, manifest present) before deploying.","Check dependency compatibility against installed plugins.","Review Jenkins logs for the underlying cause during plugin install failures."],"tags":["plugin-manager","installation","wrapping-exception","classloader"],"backgroundTag":null,"analyzedSha":"2e228ff40b14dbc8b14ffbc6edf0e4383cf744fc","analyzedAt":"2026-08-14T07:07:15.274Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}