SonarSource/sonarqube · error · IllegalArgumentException

Plugin [%s] does not exist

Error message

Plugin [%s] does not exist

What it means

ServerPluginRepository.getPlugin looks up an installed server plugin by its key and throws IllegalArgumentException when no plugin with that key is registered. It signals that code referenced a plugin (e.g. via getPluginInfo) that the SonarQube server does not have installed or whose key was mistyped.

Source

Thrown at server/sonar-webserver-api/src/main/java/org/sonar/server/plugins/ServerPluginRepository.java:75

  @CheckForNull
  public String getPluginKey(Object extension) {
    return keysByClassLoader.get(extension.getClass().getClassLoader());
  }

  @Override
  public Collection<PluginInfo> getPluginInfos() {
    return pluginByKey.values().stream().map(ServerPlugin::getPluginInfo).toList();
  }

  @Override
  public PluginInfo getPluginInfo(String key) {
    return getPlugin(key).getPluginInfo();
  }

  public ServerPlugin getPlugin(String key) {
    ServerPlugin plugin = pluginByKey.get(key);
    if (plugin == null) {
      throw new IllegalArgumentException(format("Plugin [%s] does not exist", key));
    }
    return plugin;
  }

  public Collection<ServerPlugin> getPlugins() {
    return Collections.unmodifiableCollection(pluginByKey.values());
  }

  public Optional<ServerPlugin> findPlugin(String key) {
    return Optional.ofNullable(pluginByKey.get(key));
  }

  public Collection<PluginInfo> getPluginsInfoByType(PluginType type){
    return pluginByKey.values()
      .stream()
      .filter(p -> p.getType() == type)
      .map(ServerPlugin::getPluginInfo)
      .toList();

View on GitHub (pinned to 184c821202)

Solutions

  1. List installed plugins (GET api/plugins/installed) and use the exact plugin key
  2. Install or reinstall the missing plugin and restart the server
  3. Fix the plugin key spelling/casing in the calling code or configuration

Example fix

// before
ServerPlugin plugin = pluginRepository.getPlugin("sonar-javascript");
// after
ServerPlugin plugin = pluginRepository.getPluginOptional("sonar-javascript")
  .orElseThrow(() -> new IllegalStateException("Install sonar-javascript from the marketplace before calling this"));
Defensive patterns

Strategy: try-catch

Validate before calling

boolean pluginInstalled = pluginRepository.getPlugins().stream().anyMatch(p -> p.getKey().equals(key));
if (!pluginInstalled) { throw new IllegalStateException("Plugin not installed: " + key); }

Type guard

java.util.Optional<ServerPlugin> findPlugin(ServerPluginRepository repo, String key) {
  return repo.getPlugins().stream().filter(p -> p.getKey().equals(key)).findFirst();
}

Try / catch

try {
  ServerPlugin plugin = repo.getPlugin(key);
  // use plugin
} catch (IllegalArgumentException e) {
  if (!e.getMessage().startsWith("Plugin [")) throw e;
  // handle missing plugin: skip, report, or prompt install
}

Prevention

When it happens

Trigger: Calling getPlugin(key) or getPluginInfo(key) with a plugin key that is not in the pluginByKey map — plugin not installed, plugin uninstalled/restarted away, or key casing/spelling mismatch.

Common situations: Web service calls referencing a plugin after it was removed from extensions/plugins; marketplace updates changing plugin keys; configuration or rules referencing plugins present on another server but not this one.

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/0f732dea573d5a34. Report an issue: GitHub.