quarkusio/quarkus · error · java.lang.IllegalArgumentException

Maven PURL is missing a namespace (groupId) for name (artifa

Error message

Maven PURL is missing a namespace (groupId) for name (artifactId) 

What it means

Purl's constructor throws this IllegalArgumentException when a Package URL of type 'maven' is built without a namespace. In the Maven coordinate scheme the namespace is the groupId, so it is mandatory; only the artifactId (name) was supplied. This is a fail-fast validation to keep generated PURLs spec-compliant.

Source

Thrown at independent-projects/bootstrap/app-model/src/main/java/io/quarkus/sbom/Purl.java:211

    private final Map<String, String> qualifiers;
    private final String subpath;
    private volatile String canonical;

    private Purl(String type, String namespace, String name, String version,
            Map<String, String> qualifiers, String subpath) {
        Objects.requireNonNull(type, "type is required");
        if (type.isEmpty()) {
            throw new IllegalArgumentException("type must not be empty");
        }
        validateType(type);
        this.type = type.toLowerCase(Locale.ROOT);
        this.namespace = namespace == null || namespace.isEmpty() ? null : namespace;
        Objects.requireNonNull(name, "name is required");
        if (name.isEmpty()) {
            throw new IllegalArgumentException("name must not be empty");
        }
        if (TYPE_MAVEN.equals(this.type) && this.namespace == null) {
            throw new IllegalArgumentException("Maven PURL is missing a namespace (groupId) for name (artifactId) " + name);
        }
        this.name = TYPE_NPM.equals(this.type) ? name.toLowerCase(Locale.ROOT) : name;
        this.version = version;
        this.qualifiers = qualifiers == null || qualifiers.isEmpty()
                ? Map.of()
                : qualifiers;
        this.subpath = normalizeSubpath(subpath);
    }

    public String getType() {
        return type;
    }

    public String getNamespace() {
        return namespace;
    }

    public String getName() {

View on GitHub (pinned to e1c734241f)

Solutions

  1. Provide the Maven groupId as the namespace argument: new Purl("maven", artifactId, version, /*namespace*/ groupId, ...)
  2. If you have a full coordinate string, split it and map groupId->namespace, artifactId->name before constructing
  3. If the groupId is genuinely unknown, resolve it from the pom.xml or dependency graph rather than passing null/empty

Example fix

// before
new Purl("maven", "commons-io", "2.15.0", null, qualifiers);
// after
new Purl("maven", "commons-io", "2.15.0", "commons-io", qualifiers);
Defensive patterns

Strategy: validation

Validate before calling

if (groupId == null || groupId.isEmpty()) {
    throw new IllegalArgumentException("Maven PURL requires a groupId (namespace)");
}
Purl p = new Purl("maven", artifactId, version, groupId, qualifiers);

Type guard

boolean hasNamespace(Purl p) {
    return p.getNamespace() != null && !p.getNamespace().isEmpty();
}

Try / catch

try {
    Purl p = new Purl("maven", artifactId, version, groupId, qualifiers);
} catch (IllegalArgumentException e) {
    if (e.getMessage().startsWith("Maven PURL is missing a namespace")) {
        log.errorf("Cannot build PURL: groupId missing for artifact %s", artifactId);
    }
}

Prevention

When it happens

Trigger: Calling new Purl(type, name, version, ...) (or the Purl.Builder for Maven) with type 'maven', an empty string namespace, or a namespace of null.

Common situations: Parsing Maven coordinates where only 'artifactId:version' was captured instead of 'groupId:artifactId:version'; building SBOM entries from dependency lists that dropped the groupId; passing empty-string group IDs from config or tooling output.

Related errors


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