SonarSource/sonarqube · error · IllegalStateException
Live Measure Export failed after processing
Error message
Live Measure Export failed after processing %d measures successfully
What it means
ExportLiveMeasuresStep scrolls live measures from the database and streams them as protobuf LiveMeasure messages into the dump. Any failure in the loop is rethrown as an IllegalStateException reporting the number of measures exported successfully. Like the other export steps, partial output means the whole dump is invalid.
Solutions
- Read the cause to identify whether the failure is SQL (query/timeout) or IO (stream write)
- Tune DB scroll/statement timeouts for large projects with millions of measures
- Validate MEASURES rows for the project for corrupt or null metric values
- Ensure adequate disk space on the dump volume and rerun the export
Defensive patterns
Strategy: try-catch
Validate before calling
long badMeasures = countMeasuresWithNullValue(projectUuid);
if (badMeasures > 0) { logger.warn("{} live measures may fail conversion", badMeasures); } Try / catch
try { exportLiveMeasuresStep.execute(); } catch (IllegalStateException e) { logger.error("Live measure export failed after N measures: {}", e.getCause(), e); markDumpInvalid(); } Prevention
- Tune scroll timeouts for projects with very high measure counts
- Check disk space before exporting large projects
- Detect corrupt MEASURES rows (null metric/value) during maintenance
When it happens
Trigger: SQLException in the scrolling measure select or in convertToLiveMeasure() (ResultSet field conversion), or an IOException writing the protobuf message, after `count` measures were written.
Common situations: Very large measure volume causing long scrolls and DB timeouts; corrupt MEASURES rows with unexpected value formats; dump filesystem running out of space.
Understand the failure class
Background: Database query failed: Internal Server Error 500s wrapping SQL, Prisma, and connection failures — what to check first — this error's family across 16 libraries.
Related errors
- Event Export failed after processing
- Link export failed after processing
- A plugin is storing excessively large data in the following…
- Ad-hoc rules export failed after processing
- Analysis Export failed after processing
AI-assisted analysis of SonarSource/sonarqube@184c821202 (2026-09-09).
Data as JSON: /api/errors/69af11df52ba3586.
Report an issue: GitHub.
Appendix: source
Thrown at server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/steps/ExportLiveMeasuresStep.java:76
try (
StreamWriter<LiveMeasure> output = dumpWriter.newStreamWriter(DumpElement.LIVE_MEASURES);
DbSession dbSession = dbClient.openSession(false);
PreparedStatement stmt = dbClient.getMyBatis().newScrollingSelectStatement(dbSession, QUERY)) {
stmt.setString(1, projectHolder.projectDto().getUuid());
stmt.setBoolean(2, true);
stmt.setBoolean(3, true);
try (ResultSet rs = stmt.executeQuery()) {
LiveMeasure.Builder liveMeasureBuilder = LiveMeasure.newBuilder();
while (rs.next()) {
LiveMeasure measure = convertToLiveMeasure(rs, liveMeasureBuilder);
output.write(measure);
count++;
}
LoggerFactory.getLogger(getClass()).debug("{} live measures exported", count);
}
} catch (Exception e) {
throw new IllegalStateException(format("Live Measure Export failed after processing %d measures successfully", count), e);
}
}
private LiveMeasure convertToLiveMeasure(ResultSet rs, LiveMeasure.Builder builder) throws SQLException {
builder
.clear()
.setComponentRef(componentRepository.getRef(rs.getString(1)))
.setJsonValue(rs.getString(2));
return builder.build();
}
@Override
public String getDescription() {
return "Export live measures";
}
}
View on GitHub (pinned to 184c821202)