{"record":{"id":"0f732dea573d5a34","repo":"SonarSource/sonarqube","slug":"plugin-s-does-not-exist","errorCode":null,"errorMessage":"Plugin [%s] does not exist","messagePattern":"Plugin \\[(.+?)\\] does not exist","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":400,"severity":"error","filePath":"server/sonar-webserver-api/src/main/java/org/sonar/server/plugins/ServerPluginRepository.java","lineNumber":75,"sourceCode":"  @CheckForNull\n  public String getPluginKey(Object extension) {\n    return keysByClassLoader.get(extension.getClass().getClassLoader());\n  }\n\n  @Override\n  public Collection<PluginInfo> getPluginInfos() {\n    return pluginByKey.values().stream().map(ServerPlugin::getPluginInfo).toList();\n  }\n\n  @Override\n  public PluginInfo getPluginInfo(String key) {\n    return getPlugin(key).getPluginInfo();\n  }\n\n  public ServerPlugin getPlugin(String key) {\n    ServerPlugin plugin = pluginByKey.get(key);\n    if (plugin == null) {\n      throw new IllegalArgumentException(format(\"Plugin [%s] does not exist\", key));\n    }\n    return plugin;\n  }\n\n  public Collection<ServerPlugin> getPlugins() {\n    return Collections.unmodifiableCollection(pluginByKey.values());\n  }\n\n  public Optional<ServerPlugin> findPlugin(String key) {\n    return Optional.ofNullable(pluginByKey.get(key));\n  }\n\n  public Collection<PluginInfo> getPluginsInfoByType(PluginType type){\n    return pluginByKey.values()\n      .stream()\n      .filter(p -> p.getType() == type)\n      .map(ServerPlugin::getPluginInfo)\n      .toList();","sourceCodeStart":57,"sourceCodeEnd":93,"githubUrl":"https://github.com/SonarSource/sonarqube/blob/184c821202192afc1c599fc912d0889b69fffa53/server/sonar-webserver-api/src/main/java/org/sonar/server/plugins/ServerPluginRepository.java#L57-L93","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["List installed plugins (GET api/plugins/installed) and use the exact plugin key","Install or reinstall the missing plugin and restart the server","Fix the plugin key spelling/casing in the calling code or configuration"],"exampleFix":"// before\nServerPlugin plugin = pluginRepository.getPlugin(\"sonar-javascript\");\n// after\nServerPlugin plugin = pluginRepository.getPluginOptional(\"sonar-javascript\")\n  .orElseThrow(() -> new IllegalStateException(\"Install sonar-javascript from the marketplace before calling this\"));","handlingStrategy":"try-catch","validationCode":"boolean pluginInstalled = pluginRepository.getPlugins().stream().anyMatch(p -> p.getKey().equals(key));\nif (!pluginInstalled) { throw new IllegalStateException(\"Plugin not installed: \" + key); }","typeGuard":"java.util.Optional<ServerPlugin> findPlugin(ServerPluginRepository repo, String key) {\n  return repo.getPlugins().stream().filter(p -> p.getKey().equals(key)).findFirst();\n}","tryCatchPattern":"try {\n  ServerPlugin plugin = repo.getPlugin(key);\n  // use plugin\n} catch (IllegalArgumentException e) {\n  if (!e.getMessage().startsWith(\"Plugin [\")) throw e;\n  // handle missing plugin: skip, report, or prompt install\n}","preventionTips":["Fetch installed plugin keys at startup and validate references against them","Use api/plugins/installed to confirm keys before scripting against plugins","Avoid hardcoding plugin keys; read them from configuration with a documented default"],"tags":["java","plugins","sonarqube","resource-not-found"],"backgroundTag":"resource-not-found","analyzedSha":"184c821202192afc1c599fc912d0889b69fffa53","analyzedAt":"2026-09-09T12:23:51.573Z","contentChangedAt":"2026-09-09T12:23:51.573Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}