{"record":{"id":"0a67c163a904f9f9","repo":"SonarSource/sonarqube","slug":"could-not-save-report-uuid-part-partnumber-f","errorCode":null,"errorMessage":"Could not save report ${uuid} part ${partNumber} file to database","messagePattern":"Could not save report (.+?) part (.+?) file to database","errorType":"exception","errorClass":"IllegalStateException","httpStatus":500,"severity":"error","filePath":"server/sonar-webserver-webapi/src/main/java/org/sonar/server/ce/queue/ReportSubmitter.java","lineNumber":348,"sourceCode":"      toChannel.transferFrom(sourceChannel, 0, byteSize);\n    }\n  }\n\n  private static void deleteTempFile(File file) {\n    try {\n      Files.delete(file.toPath());\n    } catch (IOException e) {\n      LOGGER.warn(\"Failed to delete temp file {}\", file.getAbsolutePath(), e);\n    }\n  }\n\n  private void saveFileOnDb(DbSession dbSession, CeTaskSubmit.Builder submit, long partIndex, File file) {\n    long partNumber = partIndex + 1;\n    LOGGER.debug(\"Saving report {} part {} on DB from file {}\", submit.getUuid(), partNumber, file.toPath());\n    try (InputStream is = Files.newInputStream(file.toPath())) {\n      dbClient.ceTaskInputDao().insert(dbSession, submit.getUuid(), partNumber, is);\n    } catch (IOException e) {\n      throw new IllegalStateException(\"Could not save report \" + submit.getUuid() + \" part \" + partNumber + \" file to database\", e);\n    }\n  }\n\n}\n","sourceCodeStart":330,"sourceCodeEnd":353,"githubUrl":"https://github.com/SonarSource/sonarqube/blob/184c821202192afc1c599fc912d0889b69fffa53/server/sonar-webserver-webapi/src/main/java/org/sonar/server/ce/queue/ReportSubmitter.java#L330-L353","documentation":"ReportSubmitter.saveFileOnDb inserts one report part into CE_TASK_INPUT by streaming the part file into the database. An IOException while opening/reading the part file is wrapped in this IllegalStateException identifying task uuid and part number. Note it only wraps IO errors — DB errors propagate as-is.","triggerScenarios":"Files.newInputStream(partFile) fails because the part temp file is missing/unreadable, or reading the stream during insert throws (storage error).","commonSituations":"Temp files cleaned up by another process before insertion; permission problems on the temp dir; disk errors; extremely large parts timing out underlying I/O.","solutions":["Check server logs for the cause and whether the part temp file still exists at the logged path","Confirm the SonarQube process can read the temp directory and files it creates","Exclude the temp directory from external cleanup services","Verify database storage (tablespace/disk) is healthy if inserts fail at scale"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"long usable = Files.getFileStore(tempDir).getUsableSpace(); if (usable < partSize) abortSubmit();","typeGuard":null,"tryCatchPattern":"try { submit(); } catch (ServerException e) if (e.message.contains(\"part\")) { inspectCeTaskInputTable(); }","preventionTips":["Protect temp dirs from external cleanup","Ensure DB storage (tablespace) has headroom","Watch CE logs for insert failures during bulk analyses"],"tags":["java","sonarqube","database","io"],"backgroundTag":"database-write-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"}