{"record":{"id":"d1b70af0d5c60528","repo":"SonarSource/sonarqube","slug":"manifest-field-does-not-have-correct-format","errorCode":null,"errorMessage":"Manifest field does not have correct format: ","messagePattern":"Manifest field does not have correct format: ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sonar-core/src/main/java/org/sonar/core/platform/PluginInfo.java","lineNumber":461,"sourceCode":"    private final String key;\n    private final Version minimalVersion;\n\n    public RequiredPlugin(String key, Version minimalVersion) {\n      this.key = key;\n      this.minimalVersion = minimalVersion;\n    }\n\n    public String getKey() {\n      return key;\n    }\n\n    public Version getMinimalVersion() {\n      return minimalVersion;\n    }\n\n    public static RequiredPlugin parse(String s) {\n      if (!PARSER.matcher(s).matches()) {\n        throw new IllegalArgumentException(\"Manifest field does not have correct format: \" + s);\n      }\n      String[] fields = StringUtils.split(s, ':');\n      return new RequiredPlugin(fields[0], Version.create(fields[1]).removeQualifier());\n    }\n\n    @Override\n    public boolean equals(Object o) {\n      if (this == o) {\n        return true;\n      }\n      if (o == null || getClass() != o.getClass()) {\n        return false;\n      }\n      RequiredPlugin that = (RequiredPlugin) o;\n      return key.equals(that.key);\n    }\n\n    @Override","sourceCodeStart":443,"sourceCodeEnd":479,"githubUrl":"https://github.com/SonarSource/sonarqube/blob/184c821202192afc1c599fc912d0889b69fffa53/sonar-core/src/main/java/org/sonar/core/platform/PluginInfo.java#L443-L479","documentation":"RequiredPlugin.parse() throws this IllegalArgumentException when a 'sonar-plugin.requiredPlugins' manifest value does not match the expected 'key:version' regex. The parser splits on ':' and requires exactly a plugin key plus a parseable version, so malformed manifest entries are rejected fail-fast.","triggerScenarios":"Calling RequiredPlugin.parse(String) with a string missing the colon separator, having empty key/version segments, extra segments, or an unparseable version (Version.create fails), typically read from a plugin manifest's RequiredPlugins attribute.","commonSituations":"A plugin author hand-editing MANIFEST.MF and writing 'base-plugin-1.0' instead of 'base-plugin:1.0'; typos or spaces around the separator; an invalid semver string like 'abc' in the version position.","solutions":["Fix the RequiredPlugins manifest value to use 'pluginKey:version' format, e.g. 'base-plugin:9.4.0'.","Ensure the version segment is a valid semver (Version.create must succeed).","Rebuild the plugin with the correct 'sonar-plugin.requiredPlugins' configuration so the manifest is regenerated.","Contact/upgrade from the plugin vendor if the shipped manifest is malformed."],"exampleFix":"// before (in MANIFEST.MF)\nsonar-plugin.requiredPlugins: base-plugin-9.4.0\n// after\nsonar-plugin.requiredPlugins: base-plugin:9.4.0","handlingStrategy":"validation","validationCode":"private static final Pattern REQUIRED = Pattern.compile(\"[a-zA-Z0-9._-]+:[0-9][a-zA-Z0-9._-]*\");\nboolean isValidRequiredPlugin(String s) {\n  return s != null && REQUIRED.matcher(s).matches();\n}","typeGuard":"boolean isValidRequiredPlugin(String s) {\n  return s != null && s.contains(\":\") && !s.startsWith(\":\") && !s.endsWith(\":\");\n}","tryCatchPattern":"try {\n  RequiredPlugin rp = RequiredPlugin.parse(value);\n} catch (IllegalArgumentException e) {\n  log.error(\"Malformed requiredPlugins entry '{}' — expected 'key:version'\", value);\n}","preventionTips":["Generate manifest entries via the sonar-packaging plugin, not hand edits.","Always use 'pluginKey:semver' with a valid semantic version.","Unit-test plugin manifests as part of the build."],"tags":["manifest","plugin-metadata","format-validation"],"backgroundTag":"invalid-argument-format","analyzedSha":"184c821202192afc1c599fc912d0889b69fffa53","analyzedAt":"2026-09-09T12:23:51.573Z","contentChangedAt":"2026-09-09T12:23:51.573Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}