{"record":{"id":"e3c91cc45d8a2489","repo":"SonarSource/sonarqube","slug":"unsupported-value-s-of-measure-level-can-not-be-e3c91c","errorCode":null,"errorMessage":"Unsupported value '%s' of Measure.Level can not be converted to QualityGateStatus","messagePattern":"Unsupported value '(.+?)' of Measure\\.Level can not be converted to QualityGateStatus","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/QualityGateMeasuresStep.java","lineNumber":142,"sourceCode":"      case OK:\n        return ConditionStatus.EvaluationStatus.OK;\n      case ERROR:\n        return ConditionStatus.EvaluationStatus.ERROR;\n      default:\n        throw new IllegalArgumentException(format(\n          \"Unsupported value '%s' of Measure.Level can not be converted to EvaluationStatus\",\n          globalLevel));\n    }\n  }\n\n  private static org.sonar.ce.task.projectanalysis.qualitygate.QualityGateStatus convert(Measure.Level globalLevel) {\n    switch (globalLevel) {\n      case OK:\n        return org.sonar.ce.task.projectanalysis.qualitygate.QualityGateStatus.OK;\n      case ERROR:\n        return org.sonar.ce.task.projectanalysis.qualitygate.QualityGateStatus.ERROR;\n      default:\n        throw new IllegalArgumentException(format(\n          \"Unsupported value '%s' of Measure.Level can not be converted to QualityGateStatus\",\n          globalLevel));\n    }\n  }\n\n  private static Map<Condition, ConditionStatus> createStatusPerCondition(Collection<Condition> conditions, Collection<EvaluatedCondition> evaluatedConditions) {\n    Map<Condition, EvaluatedCondition> evaluatedConditionPerCondition = evaluatedConditions.stream()\n      .collect(Collectors.toMap(EvaluatedCondition::getCondition, Function.identity()));\n\n    ImmutableMap.Builder<Condition, ConditionStatus> builder = ImmutableMap.builder();\n    for (Condition condition : conditions) {\n      EvaluatedCondition evaluatedCondition = evaluatedConditionPerCondition.get(condition);\n\n      if (evaluatedCondition == null) {\n        builder.put(condition, NO_VALUE_STATUS);\n      } else {\n        builder.put(condition, create(toEvaluationStatus(evaluatedCondition.getLevel()), evaluatedCondition.getActualValue()));\n      }","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/SonarSource/sonarqube/blob/184c821202192afc1c599fc912d0889b69fffa53/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/QualityGateMeasuresStep.java#L124-L160","documentation":"QualityGateMeasuresStep converts the global Measure.Level into QualityGateStatus (OK/ERROR) stored in the status holder. Only OK and ERROR are handled; any other Measure.Level value reaching convert() throws an IllegalArgumentException, an internal-invariant failure in the quality gate result pipeline.","triggerScenarios":"updateQualityGateStatusHolder calls convert(globalLevel) with a level other than OK or ERROR (e.g. NONE) after conditions were evaluated.","commonSituations":"Same root causes as the EvaluationStatus conversion failure: quality gate evaluation leaving level NONE, version skew between modules, corrupted measure data.","solutions":["Check why the quality gate evaluation produced a level other than OK/ERROR for this component","Ensure the analysis pipeline order is intact (evaluation step runs before QualityGateMeasuresStep)","Align SonarQube server/plugin versions to avoid enum drift","Report with full stack trace if reproducible on a stock setup"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if (globalLevel != Measure.Level.OK && globalLevel != Measure.Level.ERROR) {\n  throw new IllegalStateException(\"QualityGateStatus conversion requires OK/ERROR, got: \" + globalLevel);\n}","typeGuard":"boolean isConvertibleToQgStatus(Measure.Level level) {\n  return level == Measure.Level.OK || level == Measure.Level.ERROR;\n}","tryCatchPattern":"try {\n  QualityGateStatus status = convert(globalLevel);\n} catch (IllegalArgumentException e) {\n  LOGGER.error(\"Failed to map Measure.Level to QualityGateStatus\", e);\n  throw e;\n}","preventionTips":["Validate the level produced by the quality gate evaluation step before storage","Keep enum-handling switches exhaustive in one shared utility","Pin server/plugin versions to avoid enum drift","Add a default branch test in CI for enum conversions"],"tags":["sonarqube","quality-gate","enum-conversion","illegal-argument"],"backgroundTag":"invalid-enum-value","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"}