JetBrains/intellij-community · error · RuntimeException
Malformed exclusion, 'groupId:artifactName' format is expect
Error message
Malformed exclusion, 'groupId:artifactName' format is expected but got
What it means
Thrown by the Maven/Aether dependency resolver when a dependency-exclusion string cannot be parsed. Each entry in the excludedDependencies list must be exactly 'groupId:artifactName'; the code splits on the first ':' and requires exactly two non-empty parts. Anything without a colon (empty string, 'artifact', 'group:art:version' with the 2-limit split still yields 2 parts, but a bare name or blank entry) fails the split.length != 2 check.
Source
Thrown at aether-dependency-resolver/src/org/jetbrains/idea/maven/aether/ArtifactRepositoryManager.java:211
new ExclusionDependencySelector(exclusions(excludedDependencies)))
);
}
session.setReadOnly();
return session;
}
RepositorySystemSession createSessionCloneWithCleanData(RepositorySystemSession fromSession) {
DefaultRepositorySystemSession newSession = new DefaultRepositorySystemSession(fromSession).setData(new DefaultSessionData());
newSession.setReadOnly();
return newSession;
}
@SuppressWarnings("SSBasedInspection")
private static List<Exclusion> exclusions(List<String> excludedDependencies) {
return excludedDependencies.stream().map(exclusion -> {
String[] split = exclusion.split(":", 2);
if (split.length != 2) {
throw new RuntimeException("Malformed exclusion, 'groupId:artifactName' format is expected but got " + exclusion);
}
String groupId = split[0];
String artifactName = split[1];
return new Exclusion(groupId, artifactName, "*", "*");
}).collect(Collectors.toList());
}
}
/**
* Returns list of classes corresponding to classpath entries for this module.
*/
@SuppressWarnings("UnnecessaryFullyQualifiedName")
public static Class<?>[] getClassesFromDependencies() {
var result = new ArrayList<>(List.of(
org.jetbrains.idea.maven.aether.ArtifactRepositoryManager.class, //this module
org.apache.maven.repository.internal.VersionsMetadataGeneratorFactory.class, //maven-aether-provider
org.apache.maven.artifact.Artifact.class, //maven-artifact
org.apache.commons.lang3.StringUtils.class, //commons-lang3View on GitHub (pinned to be881553f2)
Solutions
- Correct the exclusion entry to the strict 'groupId:artifactName' form (e.g. 'junit:junit').
- If the value comes from UI or config, trim it and validate the format before passing it to the resolver.
- Audit the excludedDependencies list at load time and report all malformed entries at once instead of failing on the first.
Example fix
// before
List<String> excluded = List.of("junit");
// after
List<String> excluded = List.of("junit:junit"); Defensive patterns
Strategy: validation
Validate before calling
boolean valid = !exclusion.isBlank() && exclusion.indexOf(':') > 0 && exclusion.indexOf(':') < exclusion.length() - 1;
if (!valid) throw new IllegalArgumentException("Exclusion must be 'groupId:artifactName': " + exclusion); Try / catch
try { resolver.resolve(..., excludedDependencies); } catch (RuntimeException e) { if (e.getMessage().startsWith("Malformed exclusion")) reportConfigError(e.getMessage()); else throw e; } Prevention
- Validate every exclusion entry with a 'groupId:artifact' pattern check at config load time.
- Reject blank exclusion fields early in the UI instead of forwarding empty strings.
- Add a unit test asserting malformed entries are rejected with a clear message.
When it happens
Trigger: Calling the resolver API with an excludedDependencies list containing an entry that has no ':' character, e.g. "", "junit", or " org.junit " (whitespace-only). Only the presence of at least one ':' matters to split(..., 2); entries like "g:a:v" parse but silently take 'a:v' as artifactName, which is a separate config smell.
Common situations: A run configuration, plugin XML, or build DSL field for Maven import exclusions is left blank (produces ""), a user types only an artifact name, or a YAML/properties value loses its colon through quoting or templating.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- Row %d failed: hierarchicalIdx cannot be null
- Row %d access failed: hierarchicalIdx cannot be empty
- Offset out of range (from -12:00 to +14:00)
- error.text.invalid.port
- error.jdk.not.specified
AI-assisted analysis of JetBrains/intellij-community@be881553f2 (2026-08-14).
Data as JSON: /api/errors/3bea5643e5fdbf27.
Report an issue: GitHub.