quarkusio/quarkus · error · java.lang.IllegalArgumentException
name must not be empty
Error message
name must not be empty
What it means
The Purl constructor requires a non-null, non-empty name. 'name must not be empty' is thrown when constructing a Purl whose name (artifactId for Maven) is empty. Additionally, Maven purls must have a namespace (groupId).
Source
Thrown at independent-projects/bootstrap/app-model/src/main/java/io/quarkus/sbom/Purl.java:208
private final String namespace;
private final String name;
private final String version;
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;View on GitHub (pinned to e1c734241f)
Solutions
- Provide the artifact name (and groupId for Maven) before constructing
- Validate coordinates (non-empty groupId/artifactId/version) when deriving them from build metadata
- Use Purl.parse("pkg:maven/<groupId>/<artifactId>@<version>") with a complete string
Example fix
// before
Purl p = Purl.ofMaven(gav.getGroupId(), gav.getArtifactId(), version); // artifactId == ""
// after
Objects.requireNonNull(gav.getArtifactId());
if (gav.getArtifactId().isEmpty()) { throw new IllegalStateException("artifactId missing"); }
Purl p = Purl.ofMaven(gav.getGroupId(), gav.getArtifactId(), version); Defensive patterns
Strategy: validation
Validate before calling
if (name == null || name.isEmpty()) { throw new IllegalArgumentException("artifact name required"); } Type guard
boolean hasValidName(String n) { return n != null && !n.isEmpty(); } Try / catch
try { Purl p = Purl.ofMaven(groupId, artifactId, version); } catch (IllegalArgumentException e) { if (e.getMessage().contains("name must not be empty")) { artifactId = artifact.getKey().getArtifactId(); p = Purl.ofMaven(groupId, artifactId, version); } else { throw e; } } Prevention
- Resolve coordinates from MavenProject/Artifact instead of manual strings
- Validate GAV completeness before SBOM contribution
- For Maven purls always include a groupId namespace
When it happens
Trigger: Programmatic Purl construction with an empty name, or ofMaven(...) with null/empty groupId/artifactId.
Common situations: Auto-derived artifact coordinates where the artifactId variable is empty; parsing partial Maven GAV strings; config-driven SBOM contributions with blank names.
Related errors
- Invalid PURL:
- Invalid PURL qualifier
- type must not be empty
- Maven PURL is missing a namespace (groupId) for name (artifa
- PURL type must start with a letter:
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/288a6fabf52e9470.
Report an issue: GitHub.