{"record":{"id":"d1b59b521a352380","repo":"SonarSource/sonarqube","slug":"link-export-failed-after-processing-d-link-s-suc","errorCode":null,"errorMessage":"Link export failed after processing %d link(s) successfully","messagePattern":"Link export failed after processing (.+?) link\\(s\\) successfully","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/steps/ExportLinksStep.java","lineNumber":69,"sourceCode":"        StreamWriter<ProjectDump.Link> linksWriter = dumpWriter.newStreamWriter(DumpElement.LINKS)) {\n        ProjectDump.Link.Builder builder = ProjectDump.Link.newBuilder();\n        List<ProjectLinkDto> links = dbClient.projectExportDao()\n          .selectLinksForExport(dbSession, projectHolder.projectDto().getUuid());\n        for (ProjectLinkDto link : links) {\n          builder\n            .clear()\n            .setUuid(link.getUuid())\n            .setName(defaultString(link.getName()))\n            .setHref(defaultString(link.getHref()))\n            .setType(defaultString(link.getType()));\n          linksWriter.write(builder.build());\n          ++count;\n        }\n\n        LoggerFactory.getLogger(getClass()).debug(\"{} links exported\", count);\n      }\n    } catch (Exception e) {\n      throw new IllegalStateException(format(\"Link export failed after processing %d link(s) successfully\", count), e);\n    }\n  }\n\n  @Override\n  public String getDescription() {\n    return \"Export links\";\n  }\n}\n","sourceCodeStart":51,"sourceCodeEnd":78,"githubUrl":"https://github.com/SonarSource/sonarqube/blob/184c821202192afc1c599fc912d0889b69fffa53/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/steps/ExportLinksStep.java#L51-L78","documentation":"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.","triggerScenarios":"SQLException while selecting PROJECT_LINKS rows, or an IO/protobuf failure writing a link to the output, after `count` links were processed.","commonSituations":"Database connectivity issues mid-scroll; links rows containing unexpected null values; dump directory becoming unwritable (disk full, permissions).","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"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// pre-check DB reachability\nif (!dbClient.getDatabase().checkStatus().isSuccess()) { throw new IllegalStateException(\"DB unavailable\"); }","typeGuard":null,"tryCatchPattern":"try { exportLinksStep.execute(); } catch (IllegalStateException e) { logger.error(\"Link export failed: {}\", e.getCause(), e); abortExport(); }","preventionTips":["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"],"tags":["sonarqube","project-export","links","database"],"backgroundTag":"database-query-failed","analyzedSha":"184c821202192afc1c599fc912d0889b69fffa53","analyzedAt":"2026-09-09T12:23:51.573Z","contentChangedAt":"2026-09-09T12:23:51.573Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}