{"record":{"id":"ac7d9a7da8bd195e","repo":"SonarSource/sonarqube","slug":"settings-export-failed-after-processing-d-setting","errorCode":null,"errorMessage":"Settings Export failed after processing %d settings successfully","messagePattern":"Settings Export failed after processing (.+?) settings successfully","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/steps/ExportSettingsStep.java","lineNumber":76,"sourceCode":"\n      final ProjectDump.Setting.Builder builder = ProjectDump.Setting.newBuilder();\n      final List<PropertyDto> properties = dbClient.projectExportDao()\n        .selectPropertiesForExport(dbSession, projectHolder.projectDto().getUuid())\n        .stream()\n        .filter(dto -> dto.getEntityUuid() != null)\n        .filter(dto -> !IGNORED_KEYS.contains(dto.getKey()))\n        .toList();\n      for (PropertyDto property : properties) {\n        builder.clear()\n          .setKey(property.getKey())\n          .setValue(defaultString(property.getValue()));\n        output.write(builder.build());\n        ++count;\n      }\n\n      LoggerFactory.getLogger(getClass()).debug(\"{} settings exported\", count);\n    } catch (Exception e) {\n      throw new IllegalStateException(format(\"Settings Export failed after processing %d settings successfully\", count), e);\n    }\n  }\n\n  @Override\n  public String getDescription() {\n    return \"Export settings\";\n  }\n}\n","sourceCodeStart":58,"sourceCodeEnd":85,"githubUrl":"https://github.com/SonarSource/sonarqube/blob/184c821202192afc1c599fc912d0889b69fffa53/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/steps/ExportSettingsStep.java#L58-L85","documentation":"ExportSettingsStep.execute() exports all project settings to the dump, counting successes. Any exception during DB iteration or writing each setting to the output is wrapped in an IllegalStateException stating how many settings were exported before failure. SonarQube throws this so a partially written settings export never passes unnoticed.","triggerScenarios":"Exception while reading PROPERTIES rows or calling output.write(builder.build()) in execute() — e.g. DB read failure, a setting value that fails conversion to the protobuf representation (e.g. malformed multi-value or secure setting), or dump stream I/O error.","commonSituations":"Legacy/incorrectly formatted property values in the SETTINGS/PROPERTIES table breaking conversion; DB connection loss during a long export; disk errors on the CE worker.","solutions":["Check the wrapped cause; if a specific setting fails conversion, correct or delete that row in the PROPERTIES table","Verify database health and retry after transient DB errors","Ensure disk space and write access for the dump directory on the CE worker","Re-run the project export task after fixing the root cause"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// sanity-check settings values before export\nprops.forEach(p -> {\n  if (p.getValue() == null && p.getTextValue() == null) {\n    LOGGER.warn(\"Setting {} has null value; export may fail\", p.getKey());\n  }\n});","typeGuard":null,"tryCatchPattern":"try {\n  step.execute(context);\n} catch (IllegalStateException e) {\n  LOGGER.error(\"Settings export failed; inspect cause {}\", e.getCause(), e);\n}","preventionTips":["Periodically validate PROPERTIES rows for malformed values","Avoid manual edits to the settings table","Ensure disk space and DB stability during export windows"],"tags":["database","export","compute-engine","settings"],"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"}