SonarSource/sonarqube · error · IllegalStateException

not implemented

Error message

not implemented

What it means

UnsupportedOperationException thrown by QualityGatesServiceCreateResponseJsonParser.parseFrom: this parser exists only to satisfy the protobuf Parser contract for JSON-generated CreateResponse messages, and the delimited/byte-level parseFrom entry point is intentionally not implemented because this JSON representation is never transported in binary form. Callers of parseFrom/parseDelimitedFrom misuse the parser.

Source

Thrown at sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/QualityGatesServiceCreateResponseJsonParser.java:43

import com.google.protobuf.CodedInputStream;
import com.google.protobuf.ExtensionRegistryLite;
import com.google.protobuf.InvalidProtocolBufferException;
import com.google.protobuf.Parser;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.nio.ByteBuffer;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import org.sonarqube.ws.Qualitygates;

public class QualityGatesServiceCreateResponseJsonParser implements Parser<Qualitygates.CreateResponse> {

  @Override
  public Qualitygates.CreateResponse parseFrom(CodedInputStream input) throws InvalidProtocolBufferException {
    throw new IllegalStateException("not implemented");
  }

  @Override
  public Qualitygates.CreateResponse parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException {
    throw new IllegalStateException("not implemented");
  }

  @Override
  public Qualitygates.CreateResponse parsePartialFrom(CodedInputStream input) throws InvalidProtocolBufferException {
    throw new IllegalStateException("not implemented");
  }

  @Override
  public Qualitygates.CreateResponse parsePartialFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException {
    throw new IllegalStateException("not implemented");
  }

  @Override

View on GitHub (pinned to 184c821202)

Solutions

  1. Parse the response as JSON (e.g. Gson) instead of protobuf binary
  2. Use QualityGatesService.create(...) which handles the JSON response internally
  3. Do not call parseFrom on this parser; it exists only to satisfy the Parser interface

Example fix

// before
Qualitygates.CreateResponse r = Qualitygates.CreateResponse.parser().parseFrom(input); // throws
// after
Qualitygates.CreateResponse r = new Gson().fromJson(json, Qualitygates.CreateResponse.class);
Defensive patterns

Strategy: validation

Validate before calling

if (parser instanceof QualityGatesServiceCreateResponseJsonParser) {
  throw new UnsupportedOperationException("Use JSON parsing for Qualitygates.CreateResponse");
}

Try / catch

try {
  return parser.parseFrom(input);
} catch (IllegalStateException e) {
  if ("not implemented".equals(e.getMessage())) {
    return jsonParser.fromJson(json, Qualitygates.CreateResponse.class);
  }
  throw e;
}

Prevention

When it happens

Trigger: Invoking the protobuf Parser API on QualityGatesServiceCreateResponseJsonParser, e.g. Qualitygates.CreateResponse.parser().parseFrom(codedInput) or any code path routing binary input through this parser.

Common situations: Trying to decode the quality gates 'create' WS response with generated-protobuf binary deserialization instead of the JSON response the service returns.

Related errors


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