{"record":{"id":"45c0153c5edf1f48","repo":"SonarSource/sonarqube","slug":"issues-changelog-export-failed-after-processing-d","errorCode":null,"errorMessage":"Issues changelog export failed after processing %d issue changes successfully","messagePattern":"Issues changelog export failed after processing (.+?) issue changes successfully","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"critical","filePath":"server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/issue/ExportIssuesChangelogStep.java","lineNumber":83,"sourceCode":"  }\n\n  @Override\n  public void execute(Context context) {\n    long count = 0;\n    try (\n      StreamWriter<ProjectDump.IssueChange> output = dumpWriter.newStreamWriter(DumpElement.ISSUES_CHANGELOG);\n      DbSession dbSession = dbClient.openSession(false);\n      PreparedStatement stmt = createStatement(dbSession);\n      ResultSet rs = stmt.executeQuery()) {\n      ProjectDump.IssueChange.Builder builder = ProjectDump.IssueChange.newBuilder();\n      while (rs.next()) {\n        ProjectDump.IssueChange issue = toIssuesChange(builder, rs);\n        output.write(issue);\n        count++;\n      }\n      LoggerFactory.getLogger(getClass()).debug(\"{} issue changes exported\", count);\n    } catch (Exception e) {\n      throw new IllegalStateException(format(\"Issues changelog export failed after processing %d issue changes successfully\", count), e);\n    }\n  }\n\n  private PreparedStatement createStatement(DbSession dbSession) throws SQLException {\n    // export oldest entries first, so they can be imported with smallest ids\n    PreparedStatement stmt = dbClient.getMyBatis().newScrollingSelectStatement(dbSession, QUERY);\n    try {\n      stmt.setString(1, projectHolder.projectDto().getUuid());\n      stmt.setBoolean(2, true);\n      stmt.setString(3, STATUS_CLOSED);\n      return stmt;\n    } catch (Exception t) {\n      DatabaseUtils.closeQuietly(stmt);\n      throw t;\n    }\n  }\n\n  private static ProjectDump.IssueChange toIssuesChange(ProjectDump.IssueChange.Builder builder, ResultSet rs) throws SQLException {","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/SonarSource/sonarqube/blob/184c821202192afc1c599fc912d0889b69fffa53/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/issue/ExportIssuesChangelogStep.java#L65-L101","documentation":"ExportIssuesChangelogStep streams ISSUE_CHANGES rows (oldest first) into ProjectDump.IssueChange protobufs. Any exception during scrolling/conversion/writing is wrapped in an IllegalStateException that includes the count of issue changes exported successfully, to locate the failure point in a large dump.","triggerScenarios":"SQLException scrolling the issue-changes select; corrupt changelog payload failing protobuf conversion; output.write() IO error; DB connection loss mid-scroll.","commonSituations":"Very large issue changelogs (long-lived projects) hitting timeouts; corrupt ISSUE_CHANGES data after failed upgrades; connectivity blips during CE export.","solutions":["Examine the wrapped cause (SQLException or protobuf error) and fix the underlying DB/data issue.","Verify schema version matches the SonarQube version; complete any pending migration.","Check connectivity/timeout settings for long-running CE tasks and retry.","Locate the offending changelog row via the logged count and repair it."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"long changes = dbClient.issueChangeDao().countByProject(projectUuid); // sanity-check accessible rows before export","typeGuard":null,"tryCatchPattern":"try {\n  exportIssuesChangelogStep.execute(context);\n} catch (IllegalStateException e) {\n  logger.error(\"Changelog export failed after {}: {}\", parseCount(e.getMessage()), e.getCause(), e);\n  throw new JobFailure(e.getCause());\n}","preventionTips":["Complete schema migrations before exporting long-lived projects","Tune DB timeouts for huge ISSUE_CHANGES volumes","Validate changelog payloads parse as protobuf after upgrades","Diagnose using the wrapped cause and the exported count"],"tags":["export","issues","changelog","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-14T05:17:10.506Z"}