{"record":{"id":"c0229b3e70be332f","repo":"SonarSource/sonarqube","slug":"unsupported-implementation-s","errorCode":null,"errorMessage":"Unsupported implementation: %s","messagePattern":"Unsupported implementation: (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sonar-ws/src/main/java/org/sonarqube/ws/client/HttpConnector.java","lineNumber":124,"sourceCode":"\n  @Override\n  public String baseUrl() {\n    return baseUrl.url().toExternalForm();\n  }\n\n  public OkHttpClient okHttpClient() {\n    return okHttpClient;\n  }\n\n  @Override\n  public WsResponse call(WsRequest httpRequest) {\n    if (httpRequest instanceof RequestWithoutPayload httpRequestWithoutPayload) {\n      return executeRequest(httpRequestWithoutPayload);\n    }\n    if (httpRequest instanceof RequestWithPayload httpRequestWithPayload) {\n      return executeRequest(httpRequestWithPayload);\n    }\n    throw new IllegalArgumentException(format(\"Unsupported implementation: %s\", httpRequest.getClass()));\n  }\n\n  private WsResponse executeRequest(RequestWithoutPayload<?> request) {\n    HttpUrl.Builder urlBuilder = prepareUrlBuilder(request);\n    completeUrlQueryParameters(request, urlBuilder);\n\n    Request.Builder okRequestBuilder = prepareOkRequestBuilder(request, urlBuilder);\n    okRequestBuilder = request.addVerbToBuilder().apply(okRequestBuilder);\n    return new OkHttpResponse(doCall(prepareOkHttpClient(okHttpClient, request), okRequestBuilder.build()));\n  }\n\n  private WsResponse executeRequest(RequestWithPayload<?> request) {\n    HttpUrl.Builder urlBuilder = prepareUrlBuilder(request);\n\n    RequestBody body;\n    Map<String, Part> parts = request.getParts();\n    if (request.hasBody()) {\n      MediaType contentType = MediaType.parse(request.getContentType().orElse(JSON));","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/SonarSource/sonarqube/blob/184c821202192afc1c599fc912d0889b69fffa53/sonar-ws/src/main/java/org/sonarqube/ws/client/HttpConnector.java#L106-L142","documentation":"HttpConnector.call() dispatches an httpRequest to executeRequest() based on whether it implements RequestWithoutPayload or RequestWithPayload. If the request object implements neither, it throws IllegalArgumentException(\"Unsupported implementation: <class>\"). This is an internal dispatch guard — it means a request type unknown to this connector version was passed in.","triggerScenarios":"Passing a custom/legacy GetRequest/PostRequest-like object that implements neither RequestWithoutPayload nor RequestWithPayload marker interfaces; usually caused by mixing sonar-ws-client versions on the classpath or passing an object from a different library.","commonSituations":"Classpath conflicts with multiple sonar-ws versions (e.g. from a shaded dependency or older sonarqube-ws client); upgrading SonarQube client libraries without rebuilding; passing a hand-rolled request implementation.","solutions":["Use the request types built by the same sonar-ws version as the connector (GetRequest/PostRequest from org.sonarqube.ws.client).","Run mvn dependency:tree and exclude duplicate/conflicting sonar-ws-client versions.","Rebuild/re-shade after upgrading SonarQube dependencies so request and connector classes come from the same jar.","If implementing a custom request type, make it implement RequestWithoutPayload or RequestWithPayload."],"exampleFix":"// before\nMyCustomRequest req = new MyCustomRequest(\"api/issues/search\");\nwsConnector.call(req);\n// after\nGetRequest req = new GetRequest(\"api/issues/search\").setParam(\"components\", \"my_project\");\nwsConnector.call(req);","handlingStrategy":"validation","validationCode":"if (!(httpRequest instanceof RequestWithoutPayload) && !(httpRequest instanceof RequestWithPayload)) {\n  throw new IllegalArgumentException(\"Use GetRequest or PostRequest from the same sonar-ws version\");\n}","typeGuard":"static boolean isSupportedRequest(Object r) {\n  return r instanceof RequestWithoutPayload || r instanceof RequestWithPayload;\n}","tryCatchPattern":null,"preventionTips":["Build requests only with GetRequest/PostRequest from the same sonar-ws artifact as the connector.","Run dependency:tree and dedupe sonar-ws-client versions on the classpath.","Never mix request classes from different SonarQube client releases."],"tags":["http","classpath","sonarqube"],"backgroundTag":"unsupported-operation","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"}