SonarSource/sonarqube · critical · MessageException
Analysis report part is missing in database
Error message
Analysis report %s part %s is missing in database
What it means
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.
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
Defensive patterns
Strategy: validation
Validate before calling
boolean reportDataExists(DbClient db, DbSession session, String taskUuid, int part) {
return db.ceTaskInputDao().selectData(session, taskUuid, part).isPresent();
} Try / catch
try {
appendPart(dbSession, task, partNumber, destinationFile);
} catch (MessageException e) {
// mark task as failed with a clear user-facing message; do not retry blindly
failTask(task, "Report data missing in database: " + e.getMessage());
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- Analysis Export failed after processing
- Branch export failed after processing
- Can not connect to database. Please check connectivity and…
- Cannot create unique login for user name
- Component Export failed after processing
AI-assisted analysis of SonarSource/sonarqube@184c821202 (2026-09-09).
Data as JSON: /api/errors/37cbb24f51eab0b8.
Report an issue: GitHub.
Appendix: source
Thrown at server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/ExtractReportStep.java:123
} finally {
try {
Files.delete(zipfile.toPath());
} catch (IOException e) {
LOGGER.warn("Fail to delete Zip file {}", zipfile, e);
}
}
}
private void appendPart(File destinationFile, int partNumber) {
try (DbSession dbSession = dbClient.openSession(false)) {
LOGGER.debug("Reading part {} from DB", partNumber);
Optional<DbInputStream> opt = dbClient.ceTaskInputDao().selectData(dbSession, task.getUuid(), partNumber);
if (opt.isPresent()) {
try (DbInputStream reportStream = opt.get();
OutputStream out = FileUtils.newOutputStream(destinationFile, true)) {
IOUtils.copy(reportStream, out);
} catch (IOException e) {
throw new IllegalStateException("Fail to read report " + task.getUuid() + " part " + partNumber + " from database", e);
}
} else {
throw MessageException.of("Analysis report " + task.getUuid() + " part " + partNumber + " is missing in database");
}
}
}
@Override
public String getDescription() {
return "Extract report";
}
}
View on GitHub (pinned to 184c821202)