SonarSource/sonarqube · error · IllegalArgumentException

Plugin [ ] is not installed

Error message

Plugin [%s] is not installed

What it means

PluginUninstaller.uninstall only allows uninstalling plugins present in the PluginRepository AND of type EXTERNAL. If the plugin key is unknown or the plugin is a BUNDLE/CORE plugin, it throws IllegalArgumentException "Plugin [%s] is not installed".

Solutions

  1. Verify the exact plugin key via api/plugins/installed or the Marketplace UI before uninstalling.
  2. Bundled plugins cannot be uninstalled — remove/ignore them differently (they ship with SonarQube).
  3. If the plugin is already gone, refresh the plugin list; the state may be stale.
  4. For custom plugins, confirm they were installed as EXTERNAL (from Marketplace or extensions/plugins directory).

Example fix

// before
pluginUninstaller.uninstall("sonar-java"); // bundled plugin
// after (only EXTERNAL plugins)
pluginUninstaller.uninstall("mycompany-custom-rules");
Defensive patterns

Strategy: validation

Validate before calling

boolean isUninstallable(PluginRepository repo, String key) {
  return repo.hasPlugin(key) && repo.getPlugin(key).getType() == org.sonar.core.platform.PluginInfo.Type.EXTERNAL;
}

Try / catch

try { pluginUninstaller.uninstall(key); } catch (IllegalArgumentException e) { if (e.getMessage().startsWith("Plugin [") ) { log.warn("Cannot uninstall {}: not installed or not external", key); return; } throw e; }

Prevention

When it happens

Trigger: Calling uninstall (Marketplace UI or api/plugins/uninstall) with a plugin key that doesn't exist, is misspelled, or refers to a bundled plugin that cannot be removed.

Common situations: Uninstalling a bundled plugin (e.g. 'core' or language bundles); wrong plugin key casing; plugin already removed; invoking uninstall on a key taken from a different SonarQube instance.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of SonarSource/sonarqube@184c821202 (2026-09-09). Data as JSON: /api/errors/f06f6cb641a1f28b. Report an issue: GitHub.

Appendix: source

Thrown at server/sonar-webserver-api/src/main/java/org/sonar/server/plugins/PluginUninstaller.java:71

  public void start() {
    try {
      forceMkdir(fs.getUninstalledPluginsDir());
    } catch (IOException e) {
      throw new IllegalStateException("Fail to create the directory: " + fs.getUninstalledPluginsDir(), e);
    }
  }

  @Override
  public void stop() {
    // Nothing to do
  }

  /**
   * Uninstall a plugin and its dependents
   */
  public void uninstall(String pluginKey) {
    if (!pluginRepository.hasPlugin(pluginKey) || pluginRepository.getPlugin(pluginKey).getType() != EXTERNAL) {
      throw new IllegalArgumentException(format("Plugin [%s] is not installed", pluginKey));
    }

    Set<String> uninstallKeys = new HashSet<>();
    uninstallKeys.add(pluginKey);
    appendDependentPluginKeys(pluginKey, uninstallKeys);

    for (String uninstallKey : uninstallKeys) {
      PluginInfo info = pluginRepository.getPluginInfo(uninstallKey);
      // we don't check type because the dependent of an external plugin should never be a bundled plugin!
      uninstall(info.getKey(), info.getName(), info.getNonNullJarFile().getName());
    }
  }

  public void cancelUninstalls() {
    for (File file : listJarFiles(fs.getUninstalledPluginsDir())) {
      try {
        moveFileToDirectory(file, fs.getInstalledExternalPluginsDir(), false);
      } catch (IOException e) {

View on GitHub (pinned to 184c821202)