{"record":{"id":"37cbb24f51eab0b8","repo":"SonarSource/sonarqube","slug":"analysis-report-s-part-s-is-missing-in-database","errorCode":null,"errorMessage":"Analysis report %s part %s is missing in database","messagePattern":"Analysis report (.+?) part (.+?) is missing in database","errorType":"exception","errorClass":"MessageException","httpStatus":null,"severity":"critical","filePath":"server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/ExtractReportStep.java","lineNumber":123,"sourceCode":"    } finally {\n      try {\n        Files.delete(zipfile.toPath());\n      } catch (IOException e) {\n        LOGGER.warn(\"Fail to delete Zip file {}\", zipfile, e);\n      }\n    }\n  }\n\n  private void appendPart(File destinationFile, int partNumber) {\n    try (DbSession dbSession = dbClient.openSession(false)) {\n      LOGGER.debug(\"Reading part {} from DB\", partNumber);\n      Optional<DbInputStream> opt = dbClient.ceTaskInputDao().selectData(dbSession, task.getUuid(), partNumber);\n      if (opt.isPresent()) {\n        try (DbInputStream reportStream = opt.get();\n             OutputStream out = FileUtils.newOutputStream(destinationFile, true)) {\n          IOUtils.copy(reportStream, out);\n        } catch (IOException e) {\n          throw new IllegalStateException(\"Fail to read report \" + task.getUuid() + \" part \" + partNumber + \" from database\", e);\n        }\n      } else {\n        throw MessageException.of(\"Analysis report \" + task.getUuid() + \" part \" + partNumber + \" is missing in database\");\n      }\n    }\n  }\n\n  @Override\n  public String getDescription() {\n    return \"Extract report\";\n  }\n\n}\n","sourceCodeStart":105,"sourceCodeEnd":137,"githubUrl":"https://github.com/SonarSource/sonarqube/blob/184c821202192afc1c599fc912d0889b69fffa53/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/ExtractReportStep.java#L105-L137","documentation":"ExtractReportStep copies the analysis report from the CE_TASK_INPUT table (via ceTaskInputDao.selectData) part by part into local files. If the database has no row/blob for the given task UUID and part number, it throws this MessageException, meaning the persisted report data is absent while the task says an analysis report should exist.","triggerScenarios":"CE task processing calls readParts -> appendPart; selectData returns empty Optional for task.getUuid() and partNumber, i.e. the CE_TASK_INPUT row or its binary data blob is missing for that part.","commonSituations":"Database rows purged or truncated while a task was queued; sonar.ce.task serializer/db maintenance scripts deleting input data; replicated/restore databases missing BLOB content; task UUID pointing to a stale record after DB cleanup by housekeeping.","solutions":["Check CE_TASK_INPUT table for the task UUID and verify the DATA column is populated for the failing part number","If the task data is unrecoverable, cancel/fail the CE task in the UI so the worker stops retrying and a new analysis is submitted","Verify the database was not restored from a partial backup or that housekeeping (sonar.dbcleaner) did not purge rows for pending tasks","Rerun the CI analysis so a fresh report is uploaded and a new task record with valid input data is created"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"boolean reportDataExists(DbClient db, DbSession session, String taskUuid, int part) {\n  return db.ceTaskInputDao().selectData(session, taskUuid, part).isPresent();\n}","typeGuard":null,"tryCatchPattern":"try {\n  appendPart(dbSession, task, partNumber, destinationFile);\n} catch (MessageException e) {\n  // mark task as failed with a clear user-facing message; do not retry blindly\n  failTask(task, \"Report data missing in database: \" + e.getMessage());\n}","preventionTips":["Don't purge CE_TASK_INPUT rows for tasks still in PENDING/IN_PROGRESS state","Monitor dbcleaner/housekeeping settings so they never clean data for queued tasks","Verify backups/restores include BLOB content of CE_TASK_INPUT","Alert on tasks whose input data row is missing before processing"],"tags":["database","sonarqube","compute-engine","missing-data"],"backgroundTag":"resource-not-found","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"}