{"record":{"id":"288a6fabf52e9470","repo":"quarkusio/quarkus","slug":"name-must-not-be-empty-288a6f","errorCode":null,"errorMessage":"name must not be empty","messagePattern":"name must not be empty","errorType":"exception","errorClass":"java.lang.IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"independent-projects/bootstrap/app-model/src/main/java/io/quarkus/sbom/Purl.java","lineNumber":208,"sourceCode":"    private final String namespace;\n    private final String name;\n    private final String version;\n    private final Map<String, String> qualifiers;\n    private final String subpath;\n    private volatile String canonical;\n\n    private Purl(String type, String namespace, String name, String version,\n            Map<String, String> qualifiers, String subpath) {\n        Objects.requireNonNull(type, \"type is required\");\n        if (type.isEmpty()) {\n            throw new IllegalArgumentException(\"type must not be empty\");\n        }\n        validateType(type);\n        this.type = type.toLowerCase(Locale.ROOT);\n        this.namespace = namespace == null || namespace.isEmpty() ? null : namespace;\n        Objects.requireNonNull(name, \"name is required\");\n        if (name.isEmpty()) {\n            throw new IllegalArgumentException(\"name must not be empty\");\n        }\n        if (TYPE_MAVEN.equals(this.type) && this.namespace == null) {\n            throw new IllegalArgumentException(\"Maven PURL is missing a namespace (groupId) for name (artifactId) \" + name);\n        }\n        this.name = TYPE_NPM.equals(this.type) ? name.toLowerCase(Locale.ROOT) : name;\n        this.version = version;\n        this.qualifiers = qualifiers == null || qualifiers.isEmpty()\n                ? Map.of()\n                : qualifiers;\n        this.subpath = normalizeSubpath(subpath);\n    }\n\n    public String getType() {\n        return type;\n    }\n\n    public String getNamespace() {\n        return namespace;","sourceCodeStart":190,"sourceCodeEnd":226,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/sbom/Purl.java#L190-L226","documentation":"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).","triggerScenarios":"Programmatic Purl construction with an empty name, or ofMaven(...) with null/empty groupId/artifactId.","commonSituations":"Auto-derived artifact coordinates where the artifactId variable is empty; parsing partial Maven GAV strings; config-driven SBOM contributions with blank names.","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"],"exampleFix":"// before\nPurl p = Purl.ofMaven(gav.getGroupId(), gav.getArtifactId(), version); // artifactId == \"\"\n// after\nObjects.requireNonNull(gav.getArtifactId());\nif (gav.getArtifactId().isEmpty()) { throw new IllegalStateException(\"artifactId missing\"); }\nPurl p = Purl.ofMaven(gav.getGroupId(), gav.getArtifactId(), version);","handlingStrategy":"validation","validationCode":"if (name == null || name.isEmpty()) { throw new IllegalArgumentException(\"artifact name required\"); }","typeGuard":"boolean hasValidName(String n) { return n != null && !n.isEmpty(); }","tryCatchPattern":"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; } }","preventionTips":["Resolve coordinates from MavenProject/Artifact instead of manual strings","Validate GAV completeness before SBOM contribution","For Maven purls always include a groupId namespace"],"tags":["sbom","purl","validation"],"backgroundTag":"invalid-package-url","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}