{"record":{"id":"1eff70be1c9f0260","repo":"SonarSource/sonarqube","slug":"could-not-check-the-size-of-the-report-temp-file","errorCode":null,"errorMessage":"Could not check the size of the report temp file","messagePattern":"Could not check the size of the report temp file","errorType":"exception","errorClass":"IllegalStateException","httpStatus":500,"severity":"error","filePath":"server/sonar-webserver-webapi/src/main/java/org/sonar/server/ce/queue/ReportSubmitter.java","lineNumber":285,"sourceCode":"  long getReportMaxSizeBytes() {\n    return configuration.getInt(REPORT_PART_MAX_SIZE_MBYTES)\n      .map(mBytes -> mBytes * 1024 * 1024)\n      .orElse(450 * 1024 * 1024);\n  }\n\n  private static void writeReportToTempFile(InputStream reportInput, File tempFile) {\n    try {\n      Files.copy(reportInput, tempFile.toPath(), StandardCopyOption.REPLACE_EXISTING);\n    } catch (IOException e) {\n      throw new IllegalStateException(\"Could not save scanner report to temp file\", e);\n    }\n  }\n\n  private static long getSourceSize(File tempFile) {\n    try {\n      return Files.size(tempFile.toPath());\n    } catch (IOException e) {\n      throw new IllegalStateException(\"Could not check the size of the report temp file\", e);\n    }\n  }\n\n  public int splitFile(File bigFile, long sourceSize, long reportPartMaxSizeBytes, DbSession dbSession, CeTaskSubmit.Builder submit) {\n    int position = 0;\n    LOGGER.debug(\"Splitting report file {} of size {}\", bigFile.toPath(), sourceSize);\n    try (RandomAccessFile sourceFile = new RandomAccessFile(bigFile, \"r\");\n         FileChannel sourceChannel = sourceFile.getChannel()) {\n\n      final long numSplits = sourceSize / reportPartMaxSizeBytes;\n      final long remainingBytes = sourceSize % reportPartMaxSizeBytes;\n      LOGGER.debug(\"Report file {} will be split in {} parts\", bigFile.toPath(), numSplits + (remainingBytes > 0 ? 1 : 0));\n\n      for (; position < numSplits; position++) {\n        //write multipart files.\n        writePartToDb(dbSession, submit, reportPartMaxSizeBytes, position, sourceChannel, reportPartMaxSizeBytes);\n      }\n      if (remainingBytes > 0) {","sourceCodeStart":267,"sourceCodeEnd":303,"githubUrl":"https://github.com/SonarSource/sonarqube/blob/184c821202192afc1c599fc912d0889b69fffa53/server/sonar-webserver-webapi/src/main/java/org/sonar/server/ce/queue/ReportSubmitter.java#L267-L303","documentation":"ReportSubmitter.getSourceSize reads the size of the temp report file via Files.size to decide how to split it. An IOException here (file vanished between write and stat, I/O error) is wrapped in this IllegalStateException. It is an internal bookkeeping step of report submission and almost always signals storage trouble.","triggerScenarios":"Files.size(tempFile.toPath()) throws because the temp file was removed by a concurrent cleanup, or the filesystem returned an IO error after the copy step.","commonSituations":"Aggressive tmpwatch/systemd-tmpfiles cleaning during large uploads; NFS/ephemeral storage hiccups; the same temp path reused concurrently by multiple threads in a misconfigured deployment.","solutions":["Check that no cleaner (tmpwatch, tmpfiles.d) removes files during submissions","Ensure each submission uses a unique temp file / dedicated temp directory","Inspect storage health (dmesg, mount errors) if on NFS or ephemeral disks","Retry the report submission; persistent occurrences need server log analysis of the cause"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"Path tmp = Paths.get(System.getProperty(\"java.io.tmpdir\"));\nassert Files.exists(tmp) && Files.isWritable(tmp) && Files.getFileStore(tmp).getUsableSpace() > minFree;","typeGuard":null,"tryCatchPattern":"try { submit(report); } catch (ServerException e) { retryOnceAfterFsCheck(); }","preventionTips":["Disable tmpwatch/tmpfiles during CI windows","Use local (non-NFS) temp storage","Keep uploads and stat of temp files within one node"],"tags":["java","sonarqube","io","filesystem"],"backgroundTag":"file-read-failed","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"}