{"record":{"id":"f97e1adfeb0a7aa6","repo":"SonarSource/sonarqube","slug":"version-s-of-sarif-is-not-supported","errorCode":null,"errorMessage":"Version [%s] of SARIF is not supported","messagePattern":"Version \\[(.+?)\\] of SARIF is not supported","errorType":"exception","errorClass":"SarifDeserializationException","httpStatus":null,"severity":"error","filePath":"sonar-core/src/main/java/org/sonar/core/sarif/SarifSerializerImpl.java","lineNumber":81,"sourceCode":"        .writerWithDefaultPrettyPrinter()\n        .writeValueAsString(sarif210);\n    } catch (JsonProcessingException e) {\n      throw new IllegalStateException(\"Unable to serialize SARIF\", e);\n    }\n  }\n\n  @Override\n  public SarifSchema210 deserialize(Path reportPath) {\n    try {\n      return mapper\n        .enable(JsonParser.Feature.INCLUDE_SOURCE_IN_LOCATION)\n        .addHandler(new DeserializationProblemHandler() {\n          @Override\n          public Object handleInstantiationProblem(DeserializationContext ctxt, Class<?> instClass, Object argument, Throwable t) throws IOException {\n            if (!instClass.equals(SarifSchema210.Version.class)) {\n              return NOT_HANDLED;\n            }\n            throw new UnsupportedSarifVersionException(format(UNSUPPORTED_VERSION_MESSAGE_TEMPLATE, argument), t);\n          }\n        })\n        .readValue(reportPath.toFile(), SarifSchema210.class);\n    } catch (UnsupportedSarifVersionException e) {\n      throw new SarifDeserializationException(Category.MAPPING, e.getMessage(), e);\n    } catch (JsonParseException e) {\n      throw new SarifDeserializationException(Category.SYNTAX, format(SARIF_REPORT_ERROR, reportPath, e.getMessage()), e);\n    } catch (JsonMappingException e) {\n      if (e.getMessage() != null && (e.getMessage().contains(\"out of range\") || e.getMessage().contains(\"overflow\"))) {\n        throw new SarifDeserializationException(Category.VALUE, format(SARIF_REPORT_ERROR, reportPath, e.getMessage()), e);\n      }\n      throw new SarifDeserializationException(Category.MAPPING, format(SARIF_REPORT_ERROR, reportPath, e.getMessage()), e);\n    } catch (FileNotFoundException e) {\n      throw new SarifDeserializationException(Category.FILE_NOT_FOUND, format(SARIF_REPORT_ERROR, reportPath, e.getMessage()), e);\n    } catch (IOException e) {\n      throw new IllegalStateException(format(SARIF_REPORT_ERROR, reportPath, e.getMessage()), e);\n    }\n  }","sourceCodeStart":63,"sourceCodeEnd":99,"githubUrl":"https://github.com/SonarSource/sonarqube/blob/184c821202192afc1c599fc912d0889b69fffa53/sonar-core/src/main/java/org/sonar/core/sarif/SarifSerializerImpl.java#L63-L99","documentation":"This message backs UnsupportedSarifVersionException raised by SarifSerializerImpl's DeserializationProblemHandler when Jackson tries to instantiate SarifSchema210.Version from a value that does not correspond to a supported SARIF version enum constant. It is caught and rewrapped as a SarifDeserializationException (Category.MAPPING), signaling that the SARIF report declares an unsupported version.","triggerScenarios":"Deserializing a SARIF file whose \"version\" field is not a supported value (e.g. \"2.1.0\" vs an older/newer string, or a misspelled version), triggering handleInstantiationProblem for SarifSchema210.Version.","commonSituations":"Consuming SARIF 1.0 or very new SARIF files produced by tools the SonarQube scanner does not support; hand-edited SARIF files with an altered version string.","solutions":["Check the report's \"version\" field and regenerate it as SARIF 2.1.0.","Upgrade the SonarQube/Scanner version that supports the SARIF version of the report.","Convert the report with the SARIF multi-tool converter (microsoft/sarif-multitool --convert) to 2.1.0.","Fix typos in the version string if the file was hand-edited."],"exampleFix":"// before (report JSON)\n{ \"version\": \"1.0.0\", ... }\n// after\n{ \"version\": \"2.1.0\", \"$schema\": \"http://json.schemastore.org/sarif-2.1.0\", ... }","handlingStrategy":"validation","validationCode":"Set<String> SUPPORTED = Set.of(\"2.1.0\");\nString version = readJsonField(reportPath, \"version\");\nif (!SUPPORTED.contains(version)) {\n  throw new IllegalArgumentException(\"Unsupported SARIF version: \" + version);\n}","typeGuard":"boolean isSupportedSarifVersion(String v) {\n  return \"2.1.0\".equals(v); // check the report's \"version\" field before deserialize\n}","tryCatchPattern":"try {\n  SarifSchema210 sarif = serializer.deserialize(path);\n} catch (SarifDeserializationException e) {\n  if (e.getCategory() == Category.MAPPING) {\n    log.error(\"Unsupported SARIF version in {}: {}\", path, e.getMessage());\n  }\n}","preventionTips":["Validate the \"version\" field equals 2.1.0 before deserializing.","Convert legacy SARIF 1.0 reports with sarif-multitool --convert.","Keep SonarQube updated for newer SARIF version support."],"tags":["sarif","deserialization","unsupported-version"],"backgroundTag":"unsupported-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"}