{"record":{"id":"da59f2d0bf161761","repo":"jenkinsci/jenkins","slug":"0-plugin-is-already-installed-jenkins-needs-to","errorCode":null,"errorMessage":"{0} plugin is already installed. Jenkins needs to be restarted for the update to take effect.","messagePattern":"(.+?) plugin is already installed\\. Jenkins needs to be restarted for the update to take effect\\.","errorType":"exception","errorClass":"RestartRequiredException","httpStatus":null,"severity":"warning","filePath":"core/src/main/java/hudson/PluginManager.java","lineNumber":946,"sourceCode":"            try {\n                sn = strategy.getShortName(arc);\n            } catch (AbstractMethodError x) {\n                LOGGER.log(WARNING, \"JENKINS-12753 fix not active: {0}\", x.getMessage());\n                p = strategy.createPluginWrapper(arc);\n                sn = p.getShortName();\n            }\n            PluginWrapper pw = getPlugin(sn);\n            if (pw != null) {\n                if (removeExisting) { // try to load disabled plugins\n                    for (Iterator<PluginWrapper> i = plugins.iterator(); i.hasNext();) {\n                        pw = i.next();\n                        if (sn.equals(pw.getShortName())) {\n                            i.remove();\n                            break;\n                        }\n                    }\n                } else {\n                    throw new RestartRequiredException(Messages._PluginManager_PluginIsAlreadyInstalled_RestartRequired(sn));\n                }\n            }\n            if (!Lifecycle.get().supportsDynamicLoad()) {\n                throw new RestartRequiredException(Messages._PluginManager_LifecycleDoesNotSupportDynamicLoad_RestartRequired());\n            }\n            if (p == null) {\n                p = strategy.createPluginWrapper(arc);\n            }\n            if (p.supportsDynamicLoad() == YesNoMaybe.NO)\n                throw new RestartRequiredException(Messages._PluginManager_PluginDoesntSupportDynamicLoad_RestartRequired(sn));\n\n            // there's no need to do cyclic dependency check, because we are deploying one at a time,\n            // so existing plugins can't be depending on this newly deployed one.\n\n            plugins.add(p);\n            if (p.isActive()) {\n                activePlugins.add(p);\n                ((UberClassLoader) uberClassLoader).clearCacheMisses();","sourceCodeStart":928,"sourceCodeEnd":964,"githubUrl":"https://github.com/jenkinsci/jenkins/blob/2e228ff40b14dbc8b14ffbc6edf0e4383cf744fc/core/src/main/java/hudson/PluginManager.java#L928-L964","documentation":"RestartRequiredException is thrown when a plugin with the given short name is already installed and removeExisting is false. Jenkins cannot hot-deploy over an existing plugin without either removing it first or restarting. The message indicates the plugin is already present and a restart is needed for the update to take effect.","triggerScenarios":"Calling dynamicDeploy/dynamicLoad with a plugin short name that matches an already-loaded PluginWrapper, when removeExisting is not set to true.","commonSituations":"Attempting to install or update a plugin via the REST API or UI while the same plugin is already active and the deployment doesn't specify removal of the existing one.","solutions":["Set removeExisting=true in the deploy call to replace the existing plugin (only works if the plugin is disabled).","Restart Jenkins after installing the update instead of relying on dynamic load.","Use the Update Center's standard upgrade flow which handles restart scheduling."],"exampleFix":"// before — dynamic load fails because plugin exists\npluginManager.dynamicLoad(arc);\n\n// after — remove existing disabled plugin first or schedule restart\nPluginWrapper existing = pluginManager.getPlugin(sn);\nif (existing != null && !existing.isActive()) {\n    // only removable if not active\n    pluginManager.getPlugins().remove(existing);\n}\npluginManager.dynamicLoad(arc);","handlingStrategy":"validation","validationCode":"PluginWrapper existing = pluginManager.getPlugin(sn);\nif (existing != null && !removeExisting) {\n    // must restart or remove existing first\n    throw new RestartRequiredException(\"Plugin \" + sn + \" already installed; restart required.\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    pluginManager.dynamicDeploy(p, arc, removeExisting);\n} catch (RestartRequiredException e) {\n    // Schedule restart and inform user\n    listener.getLogger().println(\"Restart required: \" + e.getMessage());\n}","preventionTips":["Check if a plugin is already installed before attempting dynamic deploy.","Set removeExisting=true only when the plugin is safe to replace.","Use the update center flow for routine upgrades."],"tags":["plugin-manager","dynamic-load","restart-required"],"backgroundTag":null,"analyzedSha":"2e228ff40b14dbc8b14ffbc6edf0e4383cf744fc","analyzedAt":"2026-08-14T07:07:15.274Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}