SonarSource/sonarqube · error · IllegalStateException
Link export failed after processing
Error message
Link export failed after processing %d link(s) successfully
What it means
ExportLinksStep exports project links (PROJECT_LINKS) into the dump. Any exception in the export loop is wrapped in an IllegalStateException stating how many links were successfully exported first. Export aborts because the dump would otherwise silently miss link data.
Solutions
- Check the wrapped cause for the root failure (DB vs IO)
- Verify DB connectivity and that PROJECT_LINKS rows for the project are intact
- Confirm disk space and write access to the dump working directory
- Rerun the export after fixing the cause
Defensive patterns
Strategy: try-catch
Validate before calling
// pre-check DB reachability
if (!dbClient.getDatabase().checkStatus().isSuccess()) { throw new IllegalStateException("DB unavailable"); } Try / catch
try { exportLinksStep.execute(); } catch (IllegalStateException e) { logger.error("Link export failed: {}", e.getCause(), e); abortExport(); } Prevention
- Ensure a stable DB connection for the duration of the export task
- Fix permissions/disk space on the dump directory up front
- Validate PROJECT_LINKS data integrity for the project
When it happens
Trigger: SQLException while selecting PROJECT_LINKS rows, or an IO/protobuf failure writing a link to the output, after `count` links were processed.
Common situations: Database connectivity issues mid-scroll; links rows containing unexpected null values; dump directory becoming unwritable (disk full, permissions).
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
- Live Measure Export failed after processing
- Ad-hoc rules export failed after processing
- Analysis Export failed after processing
- Analysis report part is missing in database
AI-assisted analysis of SonarSource/sonarqube@184c821202 (2026-09-09).
Data as JSON: /api/errors/d1b59b521a352380.
Report an issue: GitHub.
Appendix: source
Thrown at server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/steps/ExportLinksStep.java:69
StreamWriter<ProjectDump.Link> linksWriter = dumpWriter.newStreamWriter(DumpElement.LINKS)) {
ProjectDump.Link.Builder builder = ProjectDump.Link.newBuilder();
List<ProjectLinkDto> links = dbClient.projectExportDao()
.selectLinksForExport(dbSession, projectHolder.projectDto().getUuid());
for (ProjectLinkDto link : links) {
builder
.clear()
.setUuid(link.getUuid())
.setName(defaultString(link.getName()))
.setHref(defaultString(link.getHref()))
.setType(defaultString(link.getType()));
linksWriter.write(builder.build());
++count;
}
LoggerFactory.getLogger(getClass()).debug("{} links exported", count);
}
} catch (Exception e) {
throw new IllegalStateException(format("Link export failed after processing %d link(s) successfully", count), e);
}
}
@Override
public String getDescription() {
return "Export links";
}
}
View on GitHub (pinned to 184c821202)