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

  1. Check the wrapped cause for the root failure (DB vs IO)
  2. Verify DB connectivity and that PROJECT_LINKS rows for the project are intact
  3. Confirm disk space and write access to the dump working directory
  4. 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

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


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)