{"record":{"id":"b3730aac7821ad19","repo":"SonarSource/sonarqube","slug":"component-export-failed-after-processing-d-compon","errorCode":null,"errorMessage":"Component Export failed after processing %d components successfully","messagePattern":"Component Export failed after processing (.+?) components successfully","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"critical","filePath":"server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/component/ExportComponentsStep.java","lineNumber":102,"sourceCode":"          .setUuidPath(uuidPath)\n          .setKey(getString(rs, 4))\n          .setName(defaultString(getString(rs, 5)))\n          .setDescription(defaultString(getString(rs, 6)))\n          .setScope(getString(rs, 7))\n          .setQualifier(qualifier)\n          .setLanguage(defaultString(getString(rs, 8)))\n          .setLongName(defaultString(getString(rs, 9)))\n          .setPath(defaultString(getString(rs, 10)))\n          .setDeprecatedKey(defaultString(getString(rs, 11)))\n          .setProjectUuid(getString(rs, 12))\n          .build();\n        output.write(component);\n        ref++;\n        count++;\n      }\n      LoggerFactory.getLogger(getClass()).debug(\"{} components exported\", count);\n    } catch (Exception e) {\n      throw new IllegalStateException(format(\"Component Export failed after processing %d components successfully\", count), e);\n    }\n  }\n\n  private PreparedStatement createSelectStatement(DbSession dbSession) throws SQLException {\n    PreparedStatement stmt = dbClient.getMyBatis().newScrollingSelectStatement(dbSession, QUERY);\n    try {\n      stmt.setString(1, projectHolder.projectDto().getUuid());\n      stmt.setBoolean(2, true);\n      stmt.setBoolean(3, true);\n      return stmt;\n    } catch (Exception t) {\n      DatabaseUtils.closeQuietly(stmt);\n      throw t;\n    }\n  }\n\n  @Override\n  public String getDescription() {","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/SonarSource/sonarqube/blob/184c821202192afc1c599fc912d0889b69fffa53/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/component/ExportComponentsStep.java#L84-L120","documentation":"ExportComponentsStep.execute() scrolls all components of the project and writes ProjectDump.Component protobufs, assigning sequential refs. Any exception in the streaming/conversion is wrapped in an IllegalStateException that includes the number of components successfully exported so far.","triggerScenarios":"SQLException on the components scrolling select; failure converting a ComponentDto (bad uuid/path data); output.write() failing mid-stream.","commonSituations":"Inconsistent component tree data (broken uuid paths, dangling parents) often from partial upgrades or manual DB changes; DB connection loss during large project export; disk/output failures.","solutions":["Read the wrapped cause; for path/uuid errors inspect the failing component row (the count tells you roughly how far it got).","Verify COMPONENTS table integrity: uuid_path and branch_uuid must reference existing rows.","Fix connectivity/disk issues and re-run the export task.","Repair or remove the inconsistent component row, ideally restoring from backup."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// pre-check component tree integrity before export\nSELECT c.uuid FROM components c LEFT JOIN components p ON c.component_uuid = p.uuid WHERE c.component_uuid IS NOT NULL AND p.uuid IS NULL;","typeGuard":null,"tryCatchPattern":"try {\n  exportComponentsStep.execute(context);\n} catch (IllegalStateException e) {\n  logger.error(\"Component export failed after {}: {}\", parseCount(e.getMessage()), e.getCause(), e);\n  throw new JobFailure(e.getCause());\n}","preventionTips":["Maintain uuid_path integrity in COMPONENTS","Complete all schema migrations after upgrades","Monitor disk and DB health before long exports","Retry the CE task only after fixing the underlying cause"],"tags":["export","components","database","sonarqube"],"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-14T00:17:10.932Z"}