{"record":{"id":"3bea5643e5fdbf27","repo":"JetBrains/intellij-community","slug":"malformed-exclusion-groupid-artifactname-format","errorCode":null,"errorMessage":"Malformed exclusion, 'groupId:artifactName' format is expected but got ","messagePattern":"Malformed exclusion, 'groupId:artifactName' format is expected but got ","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"aether-dependency-resolver/src/org/jetbrains/idea/maven/aether/ArtifactRepositoryManager.java","lineNumber":211,"sourceCode":"          new ExclusionDependencySelector(exclusions(excludedDependencies)))\n        );\n      }\n      session.setReadOnly();\n      return session;\n    }\n\n    RepositorySystemSession createSessionCloneWithCleanData(RepositorySystemSession fromSession) {\n      DefaultRepositorySystemSession newSession = new DefaultRepositorySystemSession(fromSession).setData(new DefaultSessionData());\n      newSession.setReadOnly();\n      return newSession;\n    }\n\n    @SuppressWarnings(\"SSBasedInspection\")\n    private static List<Exclusion> exclusions(List<String> excludedDependencies) {\n      return excludedDependencies.stream().map(exclusion -> {\n        String[] split = exclusion.split(\":\", 2);\n        if (split.length != 2) {\n          throw new RuntimeException(\"Malformed exclusion, 'groupId:artifactName' format is expected but got \" + exclusion);\n        }\n        String groupId = split[0];\n        String artifactName = split[1];\n        return new Exclusion(groupId, artifactName, \"*\", \"*\");\n      }).collect(Collectors.toList());\n    }\n }\n\n  /**\n   * Returns list of classes corresponding to classpath entries for this module.\n   */\n  @SuppressWarnings(\"UnnecessaryFullyQualifiedName\")\n  public static Class<?>[] getClassesFromDependencies() {\n    var result = new ArrayList<>(List.of(\n      org.jetbrains.idea.maven.aether.ArtifactRepositoryManager.class, //this module\n      org.apache.maven.repository.internal.VersionsMetadataGeneratorFactory.class, //maven-aether-provider\n      org.apache.maven.artifact.Artifact.class, //maven-artifact\n      org.apache.commons.lang3.StringUtils.class, //commons-lang3","sourceCodeStart":193,"sourceCodeEnd":229,"githubUrl":"https://github.com/JetBrains/intellij-community/blob/be881553f2a76ac8b4ea53950d93f0de78295c19/aether-dependency-resolver/src/org/jetbrains/idea/maven/aether/ArtifactRepositoryManager.java#L193-L229","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nList<String> excluded = List.of(\"junit\");\n\n// after\nList<String> excluded = List.of(\"junit:junit\");","handlingStrategy":"validation","validationCode":"boolean valid = !exclusion.isBlank() && exclusion.indexOf(':') > 0 && exclusion.indexOf(':') < exclusion.length() - 1;\nif (!valid) throw new IllegalArgumentException(\"Exclusion must be 'groupId:artifactName': \" + exclusion);","typeGuard":null,"tryCatchPattern":"try { resolver.resolve(..., excludedDependencies); } catch (RuntimeException e) { if (e.getMessage().startsWith(\"Malformed exclusion\")) reportConfigError(e.getMessage()); else throw e; }","preventionTips":["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."],"tags":["maven","aether","dependencies","configuration","validation"],"backgroundTag":null,"analyzedSha":"be881553f2a76ac8b4ea53950d93f0de78295c19","analyzedAt":"2026-08-14T14:13:06.425Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}