{"record":{"id":"5dcaf39bb486b144","repo":"SonarSource/sonarqube","slug":"no-plugin-with-key-s-or-plugin-s-is-already-5dcaf3","errorCode":null,"errorMessage":"No plugin with key '%s' or plugin '%s' is already in latest compatible version","messagePattern":"No plugin with key '(.+?)' or plugin '(.+?)' is already in latest compatible version","errorType":"http","errorClass":"IllegalArgumentException","httpStatus":400,"severity":"error","filePath":"server/sonar-webserver-webapi/src/main/java/org/sonar/server/plugins/ws/UpdateAction.java","lineNumber":92,"sourceCode":"    String key = request.mandatoryParam(PARAM_KEY);\n    PluginUpdate pluginUpdate = findPluginUpdateByKey(key);\n    pluginDownloader.download(key, pluginUpdate.getRelease().getVersion());\n    response.noContent();\n  }\n\n  @Nonnull\n  private PluginUpdate findPluginUpdateByKey(String key) {\n    Optional<UpdateCenter> updateCenter = updateCenterFactory.getUpdateCenter(false);\n    PluginUpdate pluginUpdate = MISSING_PLUGIN;\n\n    if (updateCenter.isPresent()) {\n      pluginUpdate = updateCenter.get().findPluginUpdates().stream()\n        .filter(update -> update != null && key.equals(update.getPlugin().getKey()))\n        .findFirst().orElse(MISSING_PLUGIN);\n    }\n\n    if (pluginUpdate == MISSING_PLUGIN) {\n      throw new IllegalArgumentException(\n        format(\"No plugin with key '%s' or plugin '%s' is already in latest compatible version\", key, key));\n    }\n    return pluginUpdate;\n  }\n}\n","sourceCodeStart":74,"sourceCodeEnd":98,"githubUrl":"https://github.com/SonarSource/sonarqube/blob/184c821202192afc1c599fc912d0889b69fffa53/server/sonar-webserver-webapi/src/main/java/org/sonar/server/plugins/ws/UpdateAction.java#L74-L98","documentation":"UpdateAction implements api/plugins/update. It resolves the requested key among the update center's plugin updates; if no compatible update exists — the key is unknown, the plugin has no newer compatible version, or the update center is unavailable — it throws IllegalArgumentException saying the plugin is absent or already in its latest compatible version.","triggerScenarios":"POST api/plugins/update?key=<key> where no update-center entry matches the key with a newer compatible release: plugin already up to date, wrong/renamed key, or update center fetch failed so findPluginUpdates is empty.","commonSituations":"Idempotent upgrade scripts re-running against an already-patched server; SonarQube version too new/old for the plugin's compatible releases so no compatible update appears; firewalled servers that cannot reach the update center.","solutions":["Verify with GET api/plugins/updates that the key has a pending update; skip the update call when none exists.","Make the script idempotent: only call api/plugins/update when api/plugins/updates lists that key.","Confirm the update center is reachable (sonar.updatecenter.url, proxy settings) and that your SonarQube version has compatible plugin releases; then retry."],"exampleFix":"// before\nawait api.plugins.update({ key: 'sonar-java' }); // fails when already latest\n// after\nconst updates = await api.plugins.updates();\nif (updates.plugins.some(p => p.key === 'sonar-java')) {\n  await api.plugins.update({ key: 'sonar-java' });\n}","handlingStrategy":"validation","validationCode":"const updates = (await api.plugins.updates()).plugins;\nconst pending = updates.find(p => p.key === key);\nif (!pending) throw new Error(`no compatible update for '${key}'; already latest or unknown key`);","typeGuard":"function hasPendingUpdate(updates, key) {\n  return Array.isArray(updates) && updates.some(p => p && p.key === key);\n}","tryCatchPattern":"try {\n  await api.plugins.update({ key });\n} catch (e) {\n  if (String(e.message).startsWith('No plugin with key')) {\n    log(`no update to apply for '${key}'`);\n    return;\n  }\n  throw e;\n}","preventionTips":["Check api/plugins/updates before calling the update WS to keep scripts idempotent.","Confirm SonarQube/core version compatibility so compatible updates exist.","Validate update-center connectivity (proxy, sonar.updatecenter.url) before upgrade windows."],"tags":["sonarqube","webapi","plugin","update"],"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-17T15:17:12.973Z"}