SonarSource/sonarqube · error · IllegalArgumentException
Manifest field does not have correct format:
Error message
Manifest field does not have correct format:
What it means
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.
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.
Example fix
// before (in MANIFEST.MF) sonar-plugin.requiredPlugins: base-plugin-9.4.0 // after sonar-plugin.requiredPlugins: base-plugin:9.4.0
Defensive patterns
Strategy: validation
Validate before calling
private static final Pattern REQUIRED = Pattern.compile("[a-zA-Z0-9._-]+:[0-9][a-zA-Z0-9._-]*");
boolean isValidRequiredPlugin(String s) {
return s != null && REQUIRED.matcher(s).matches();
} Type guard
boolean isValidRequiredPlugin(String s) {
return s != null && s.contains(":") && !s.startsWith(":") && !s.endsWith(":");
} Try / catch
try {
RequiredPlugin rp = RequiredPlugin.parse(value);
} catch (IllegalArgumentException e) {
log.error("Malformed requiredPlugins entry '{}' — expected 'key:version'", value);
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
AI-assisted analysis of SonarSource/sonarqube@184c821202 (2026-09-09).
Data as JSON: /api/errors/d1b70af0d5c60528.
Report an issue: GitHub.
Appendix: source
Thrown at sonar-core/src/main/java/org/sonar/core/platform/PluginInfo.java:461
private final String key;
private final Version minimalVersion;
public RequiredPlugin(String key, Version minimalVersion) {
this.key = key;
this.minimalVersion = minimalVersion;
}
public String getKey() {
return key;
}
public Version getMinimalVersion() {
return minimalVersion;
}
public static RequiredPlugin parse(String s) {
if (!PARSER.matcher(s).matches()) {
throw new IllegalArgumentException("Manifest field does not have correct format: " + s);
}
String[] fields = StringUtils.split(s, ':');
return new RequiredPlugin(fields[0], Version.create(fields[1]).removeQualifier());
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
RequiredPlugin that = (RequiredPlugin) o;
return key.equals(that.key);
}
@OverrideView on GitHub (pinned to 184c821202)