SonarSource/sonarqube · critical · IllegalStateException
Issue export failed after processing
Error message
Issue export failed after processing %d issues successfully
What it means
ExportIssuesStep.execute() streams all ISSUES of the project, converting each IssueDto to a ProjectDump.Issue protobuf. Any exception in the stream (SQL error, conversion failure, IO write error) is wrapped in an IllegalStateException that reports how many issues were exported successfully before failing.
Solutions
- Inspect the wrapped cause: for missing refs ensure all rules/components of the issues are exported (check earlier export steps' logs).
- Fix DB connectivity/timeout issues and retry the export task.
- Verify ISSUES protobuf columns parse cleanly; repair corrupt rows.
- Ensure consistent SonarQube DB schema version (run upgrades).
Defensive patterns
Strategy: retry
Validate before calling
long issues = dbClient.issueDao().countByProject(projectUuid); // pre-check accessibility and volume before export
Try / catch
try {
exportIssuesStep.execute(context);
} catch (IllegalStateException e) {
logger.error("Issue export failed after {}: {}", parseCount(e.getMessage()), e.getCause(), e);
throw new JobFailure(e.getCause());
} Prevention
- Ensure rules and components referenced by issues exist in the dump
- Verify ISSUES protobuf columns are valid after any upgrade
- Stabilize DB connectivity before long export tasks
- Always inspect e.getCause() for the actionable error
When it happens
Trigger: SQLException on the scrolling issue select; convertToIssue failures (missing rule/component refs, corrupt protobuf columns); output.write() failure; DB connection loss.
Common situations: Projects with issues referencing rules or components absent from the dump; corrupt ISSUES blobs (locations, message formattings); DB instability during long exports of large projects.
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
- Issues changelog export failed after processing
- Analysis Export failed after processing
- Branch export failed after processing
- Component Export failed after processing
- Fail to read locations from DB for issue
AI-assisted analysis of SonarSource/sonarqube@184c821202 (2026-09-09).
Data as JSON: /api/errors/c1a89ee41f95b1a1.
Report an issue: GitHub.
Appendix: source
Thrown at server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/issue/ExportIssuesStep.java:89
@Override
public void execute(Context context) {
MutableLong count = MutableLong.valueOf(0);
try (
StreamWriter<ProjectDump.Issue> output = dumpWriter.newStreamWriter(DumpElement.ISSUES);
DbSession dbSession = dbClient.openSession(false);
Cursor<IssueDto> issueDtoCursor = dbClient.projectExportDao()
.scrollIssueForExport(dbSession, projectHolder.projectDto().getUuid())) {
ProjectDump.Issue.Builder issueBuilder = ProjectDump.Issue.newBuilder();
issueDtoCursor
.forEach(issueDto -> {
ProjectDump.Issue issue = convertToIssue(issueDto, issueBuilder);
output.write(issue);
count.getAndInc();
});
LoggerFactory.getLogger(getClass()).debug("{} issues exported", count.value);
} catch (Exception e) {
throw new IllegalStateException(format("Issue export failed after processing %d issues successfully", count.value), e);
}
}
private ProjectDump.Issue convertToIssue(IssueDto issueDto, ProjectDump.Issue.Builder builder) {
String ruleRef = registerRule(issueDto);
builder
.clear()
.setRuleRef(ruleRef)
.setUuid(issueDto.getKee())
.setComponentRef(componentRepository.getRef(issueDto.getComponentUuid()))
.setType(issueDto.getType())
.setMessage(Optional.of(issueDto).map(IssueDto::getMessage).orElse(""))
.setLine(Optional.of(issueDto).map(IssueDto::getLine).orElse(0))
.setChecksum(Optional.of(issueDto).map(IssueDto::getChecksum).orElse(""))
.setStatus(Optional.of(issueDto).map(IssueDto::getStatus).orElse(""))
.setResolution(Optional.of(issueDto).map(IssueDto::getResolution).orElse(""))
.setSeverity(Optional.of(issueDto).map(IssueDto::getSeverity).orElse(""))View on GitHub (pinned to 184c821202)