{"record":{"id":"13f028d049b8870d","repo":"quarkusio/quarkus","slug":"module-id-is-missing","errorCode":null,"errorMessage":"Module id is missing","messagePattern":"Module id is missing","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/workspace/DefaultWorkspaceModule.java","lineNumber":182,"sourceCode":"        }\n\n        @Override\n        public Builder setAdditionalTestClasspathElements(Collection<String> elements) {\n            DefaultWorkspaceModule.this.additionalTestClasspathElements = elements;\n            return this;\n        }\n\n        @Override\n        public Builder setParent(WorkspaceModule parent) {\n            DefaultWorkspaceModule.this.parent = parent;\n            return this;\n        }\n\n        @Override\n        public WorkspaceModule build() {\n            final DefaultWorkspaceModule module = DefaultWorkspaceModule.this;\n            if (module.id == null) {\n                throw new IllegalArgumentException(\"Module id is missing\");\n            }\n            module.directDepConstraints = module.directDepConstraints == null ? Collections.emptyList()\n                    : Collections.unmodifiableList(module.directDepConstraints);\n            module.directDeps = module.directDeps == null ? Collections.emptyList()\n                    : Collections.unmodifiableList(module.directDeps);\n            module.sourcesSets = Collections.unmodifiableMap(module.sourcesSets);\n            return module;\n        }\n\n        @Override\n        public WorkspaceModuleId getId() {\n            return DefaultWorkspaceModule.this.getId();\n        }\n\n        @Override\n        public File getModuleDir() {\n            return DefaultWorkspaceModule.this.getModuleDir();\n        }","sourceCodeStart":164,"sourceCodeEnd":200,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/workspace/DefaultWorkspaceModule.java#L164-L200","documentation":"DefaultWorkspaceModule.Builder.build() throws IllegalArgumentException when the module's id was never set. A workspace module must have a WorkspaceModuleId (GAV-style coordinates) before it can be finished; the library enforces this as a mandatory invariant of the builder protocol.","triggerScenarios":"Calling builder.build() without having called setId()/withId(...) (or an equivalent) on the DefaultWorkspaceModule.Builder first.","commonSituations":"Programmatically constructing workspace modules for tooling/tests and forgetting the id; a workspace descriptor (e.g. a pom or module file) parsed into a builder whose coordinates could not be resolved; copy-pasted builder code that sets dependencies but not the id.","solutions":["Call setId(...) with a valid WorkspaceModuleId (e.g. WorkspaceModuleId.of(groupId, artifactId, version)) before build()","If building from a descriptor, ensure the coordinates are present and parsed into the id","Add a null check on the id field early in your own code to fail fast with a clearer message"],"exampleFix":"// before\nDefaultWorkspaceModule.Builder b = new DefaultWorkspaceModule.Builder();\nb.addSourceSet(...);\nWorkspaceModule m = b.build(); // throws\n// after\nb.setId(WorkspaceModuleId.of(\"com.acme\", \"app\", \"1.0.0\"));\nWorkspaceModule m = b.build();","handlingStrategy":"validation","validationCode":"if (builderId == null) {\n    throw new IllegalArgumentException(\"Set module id before build(); use WorkspaceModuleId.of(g, a, v)\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    WorkspaceModule m = builder.build();\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().equals(\"Module id is missing\")) {\n        builder.setId(defaultId);\n    }\n}","preventionTips":["Always call setId(...) immediately after obtaining a workspace module builder","Centralize builder construction in a factory that enforces the id","Validate descriptor files contain coordinates before feeding builders","Write builder setup as a single method so the id is never skipped"],"tags":["workspace","builder","missing-identifier","validation"],"backgroundTag":"missing-required-argument","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"}