SonarSource/sonarqube · error · IllegalStateException

Failed to split report for task

Error message

Failed to split report for task ${uuid}

What it means

ReportSubmitter.splitFile chops the report temp file into chunks of reportPartMaxSizeBytes and writes each part to the database through a FileChannel. Any IOException during reading/writing parts is wrapped in this IllegalStateException including the CE task uuid. It means the report could not be sliced for Compute Engine processing.

Solutions

  1. Verify free disk space and temp-file integrity during large report uploads
  2. Check CE and web server logs for the wrapped IOException cause
  3. Increase/adjust sonar.ce.task report size settings if parts are exceeding limits
  4. Retry the analysis; if DB-related, verify database connectivity and ce_task_input table health
Defensive patterns

Strategy: retry

Validate before calling

if (Files.size(tempFile) > maxReportSize) splitOrTrimBeforeSubmit();

Try / catch

try { submit(); } catch (ServerException e) if (e.status == 500 && e.message.startsWith("Failed to split report")) { retryWithBackoff(); }

Prevention

When it happens

Trigger: IOException while reading the source channel (disk error, truncated temp file) or while writing parts inside writePartToDb during the split loop of a large report.

Common situations: Reports larger than configured max size hitting storage failures; disk full mid-split; temp file corrupted; DB connection dropped mid-part-write surfacing as IO failure in the split path.

Understand the failure class

Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.

Related errors


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

Appendix: source

Thrown at server/sonar-webserver-webapi/src/main/java/org/sonar/server/ce/queue/ReportSubmitter.java:308

    int position = 0;
    LOGGER.debug("Splitting report file {} of size {}", bigFile.toPath(), sourceSize);
    try (RandomAccessFile sourceFile = new RandomAccessFile(bigFile, "r");
         FileChannel sourceChannel = sourceFile.getChannel()) {

      final long numSplits = sourceSize / reportPartMaxSizeBytes;
      final long remainingBytes = sourceSize % reportPartMaxSizeBytes;
      LOGGER.debug("Report file {} will be split in {} parts", bigFile.toPath(), numSplits + (remainingBytes > 0 ? 1 : 0));

      for (; position < numSplits; position++) {
        //write multipart files.
        writePartToDb(dbSession, submit, reportPartMaxSizeBytes, position, sourceChannel, reportPartMaxSizeBytes);
      }
      if (remainingBytes > 0) {
        writePartToDb(dbSession, submit, remainingBytes, position, sourceChannel, reportPartMaxSizeBytes);
        return position + 1;
      }
    } catch (IOException e) {
      throw new IllegalStateException("Failed to split report for task " + submit.getUuid(), e);
    }
    return position;
  }

  private void writePartToDb(DbSession dbSession, CeTaskSubmit.Builder submit, long byteSize, long partIndex, FileChannel sourceChannel, long reportPartMaxSizeBytes)
    throws IOException {
    File file = tempFolder.newFile();
    try {
      writePart(byteSize, partIndex, sourceChannel, reportPartMaxSizeBytes, file);

      saveFileOnDb(dbSession, submit, partIndex, file);
    } finally {
      deleteTempFile(file);
    }
  }

  private static void writePart(long byteSize, long partIndex, FileChannel sourceChannel, long reportPartMaxSizeBytes, File file) throws IOException {
    try (RandomAccessFile toFile = new RandomAccessFile(file, "rw");

View on GitHub (pinned to 184c821202)