quarkusio/quarkus · error · IllegalArgumentException

Bad artifact coordinates , expected format is <groupId>:<art

Error message

Bad artifact coordinates , expected format is <groupId>:<artifactId>[:<extension>|[:<classifier>:<extension>]]:<version>

What it means

DependencyUtils.toArtifact parses a coordinate string into a Maven DefaultArtifact. Strings not matching groupId:artifactId[:extension][:classifier]:extension:version structure are rejected by illegalDependencyFormat with this IllegalArgumentException. The parser cannot recover partial coordinates.

Source

Thrown at independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/util/DependencyUtils.java:185

                offset = colon + 1;
                colon = str.indexOf(':', offset);
                if (colon < 0) {
                    version = str.substring(offset, length);
                } else {
                    if (colon == length - 1) {
                        illegalDependencyFormat(str);
                    }
                    classifier = type;
                    type = str.substring(offset, colon);
                    version = str.substring(colon + 1);
                }
            }
        }
        return new DefaultArtifact(groupId, artifactId, classifier, type, version);
    }

    private static void illegalDependencyFormat(String str) {
        throw new IllegalArgumentException("Bad artifact coordinates " + str
                + ", expected format is <groupId>:<artifactId>[:<extension>|[:<classifier>:<extension>]]:<version>");
    }

    public static ResolvedDependencyBuilder newDependencyBuilder(DependencyNode node, MavenArtifactResolver resolver)
            throws BootstrapMavenException {
        var artifact = node.getDependency().getArtifact();
        if (artifact.getFile() == null) {
            artifact = resolver.resolve(artifact, node.getRepositories()).getArtifact();
        }
        int flags = 0;
        if (node.getDependency().isOptional()) {
            flags |= DependencyFlags.OPTIONAL;
        }
        WorkspaceModule module = null;
        if (resolver.getProjectModuleResolver() != null) {
            module = resolver.getProjectModuleResolver().getProjectModule(artifact.getGroupId(), artifact.getArtifactId(),
                    artifact.getVersion());
            if (module != null) {

View on GitHub (pinned to e1c734241f)

Solutions

  1. Supply the full coordinates including the version: groupId:artifactId:version (or with extension/classifier segments in the documented order)
  2. Print the offending string (it is echoed in the message) and count the ':' segments against the expected format
  3. If coordinates are built dynamically, check the interpolated variables are non-empty
  4. Validate with 'mvn dependency:get -Dartifact=...' to confirm the coordinates are syntactically valid

Example fix

// before
String coords = "org.acme:my-extension"; // no version
DependencyUtils.toArtifact(coords);
// after
String coords = "org.acme:my-extension:jar:1.0.0";
DependencyUtils.toArtifact(coords);
Defensive patterns

Strategy: validation

Validate before calling

boolean validCoords(String s) {
    if (s == null || s.isEmpty()) return false;
    String[] parts = s.split(":");
    return parts.length >= 3 && parts.length <= 5
        && java.util.Arrays.stream(parts).allMatch(p -> !p.isEmpty());
}
if (!validCoords(coords)) throw new IllegalArgumentException("Bad coordinates: " + coords);

Try / catch

try {
    Artifact a = DependencyUtils.toArtifact(coords);
} catch (IllegalArgumentException e) {
    log.error("Fix coordinate string: " + e.getMessage());
}

Prevention

When it happens

Trigger: Passing a malformed coordinates string to the DependencyUtils/Bootstrap artifact-parsing API: missing version, too few or too many colon-separated segments, or empty segments (e.g. 'org.acme:app' with no version, or a stray trailing ':').

Common situations: Configuration properties (quarkus.platform.group-id etc., extensions lists) where a user forgot the :version; programmatically built coordinate strings where an empty variable was interpolated; hand-edited POM properties containing artifact keys.

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/74fda3e737fcaf19. Report an issue: GitHub.