SonarSource/sonarqube · error · ServerException

${e.getMessage()}

Error message

${e.getMessage()}

What it means

SubmitAction.handle submits a scanner report and serializes the CeTaskSubmitResponse. Any IllegalStateException raised during submission (e.g. wrapped IO failures from report saving/splitting) is caught, logged at debug, and rethrown as a ServerException with HTTP 500 carrying the original message. Clients see this message as the WS error body.

Source

Thrown at server/sonar-webserver-webapi/src/main/java/org/sonar/server/ce/ws/SubmitAction.java:114

  }

  @Override
  public void handle(Request wsRequest, Response wsResponse) throws Exception {
    String projectKey = wsRequest.mandatoryParam(PARAM_PROJECT_KEY);
    String projectName = abbreviate(defaultIfBlank(wsRequest.param(PARAM_PROJECT_NAME), projectKey), MAX_COMPONENT_NAME_LENGTH);

    Map<String, String> characteristics = parseTaskCharacteristics(wsRequest);

    try (InputStream report = new BufferedInputStream(wsRequest.mandatoryParamAsPart(PARAM_REPORT_DATA).getInputStream())) {
      CeTask task = reportSubmitter.submit(projectKey, projectName, characteristics, report);
      Ce.SubmitResponse submitResponse = Ce.SubmitResponse.newBuilder()
        .setTaskId(task.getUuid())
        .setProjectId(task.getComponent().get().getUuid())
        .build();
      WsUtils.writeProtobuf(submitResponse, wsRequest, wsResponse);
    } catch (IllegalStateException e) {
      LOGGER.debug(e.getMessage(), e);
      throw new ServerException(HTTP_INTERNAL_ERROR, e.getMessage());
    }
  }

  private static Map<String, String> parseTaskCharacteristics(Request wsRequest) {
    Map<String, String> characteristics = new LinkedHashMap<>();

    for (String param : wsRequest.multiParam(PARAM_ANALYSIS_CHARACTERISTIC)) {
      String[] pair = StringUtils.split(param, "=", 2);
      checkRequest(pair.length == 2, "Parameter '%s' must be a key-value pair with the format 'key=value'.", PARAM_ANALYSIS_CHARACTERISTIC);
      checkRequest(!characteristics.containsKey(pair[0]), "Key '%s' was provided twice with parameters '%s'", pair[0], PARAM_ANALYSIS_CHARACTERISTIC);
      if (CeTaskCharacteristicDto.SUPPORTED_KEYS.contains(pair[0])) {
        characteristics.put(pair[0], pair[1]);
      }
    }
    return characteristics;
  }

}

View on GitHub (pinned to 184c821202)

Solutions

  1. Enable debug logging on the web server to see the root IllegalStateException cause
  2. Free disk space / fix the temp directory used for report uploads, then retry the scan
  3. Retry the CI analysis after resolving storage issues
  4. If persistent, verify sonar.ce.queue settings and database storage for CE task inputs
Defensive patterns

Strategy: try-catch

Validate before calling

long free = Files.getFileStore(tempDir).getUsableSpace(); if (free < reportLength * 2L) freeSpaceBeforeScan();

Try / catch

try { submit(); } catch (ServerException e) if (e.status == 500) { enableWebDebugLogs(); retryAfterFsCheck(); }

Prevention

When it happens

Trigger: POST api/ce/submit where the internal pipeline throws IllegalStateException — most commonly the 'Could not save scanner report to temp file', size-check, or split failures caused by disk/temp problems.

Common situations: Full temp disk during large report upload; scanner aborting the stream; underlying storage failures surfacing as 500 to the CI job with only the message text (details at debug level).

Understand the failure class

Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.

Related errors


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