quarkusio/quarkus · error · IllegalArgumentException

Module id is missing

Error message

Module id is missing

What it means

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.

Source

Thrown at independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/workspace/DefaultWorkspaceModule.java:182

        }

        @Override
        public Builder setAdditionalTestClasspathElements(Collection<String> elements) {
            DefaultWorkspaceModule.this.additionalTestClasspathElements = elements;
            return this;
        }

        @Override
        public Builder setParent(WorkspaceModule parent) {
            DefaultWorkspaceModule.this.parent = parent;
            return this;
        }

        @Override
        public WorkspaceModule build() {
            final DefaultWorkspaceModule module = DefaultWorkspaceModule.this;
            if (module.id == null) {
                throw new IllegalArgumentException("Module id is missing");
            }
            module.directDepConstraints = module.directDepConstraints == null ? Collections.emptyList()
                    : Collections.unmodifiableList(module.directDepConstraints);
            module.directDeps = module.directDeps == null ? Collections.emptyList()
                    : Collections.unmodifiableList(module.directDeps);
            module.sourcesSets = Collections.unmodifiableMap(module.sourcesSets);
            return module;
        }

        @Override
        public WorkspaceModuleId getId() {
            return DefaultWorkspaceModule.this.getId();
        }

        @Override
        public File getModuleDir() {
            return DefaultWorkspaceModule.this.getModuleDir();
        }

View on GitHub (pinned to e1c734241f)

Solutions

  1. Call setId(...) with a valid WorkspaceModuleId (e.g. WorkspaceModuleId.of(groupId, artifactId, version)) before build()
  2. If building from a descriptor, ensure the coordinates are present and parsed into the id
  3. Add a null check on the id field early in your own code to fail fast with a clearer message

Example fix

// before
DefaultWorkspaceModule.Builder b = new DefaultWorkspaceModule.Builder();
b.addSourceSet(...);
WorkspaceModule m = b.build(); // throws
// after
b.setId(WorkspaceModuleId.of("com.acme", "app", "1.0.0"));
WorkspaceModule m = b.build();
Defensive patterns

Strategy: validation

Validate before calling

if (builderId == null) {
    throw new IllegalArgumentException("Set module id before build(); use WorkspaceModuleId.of(g, a, v)");
}

Try / catch

try {
    WorkspaceModule m = builder.build();
} catch (IllegalArgumentException e) {
    if (e.getMessage().equals("Module id is missing")) {
        builder.setId(defaultId);
    }
}

Prevention

When it happens

Trigger: Calling builder.build() without having called setId()/withId(...) (or an equivalent) on the DefaultWorkspaceModule.Builder first.

Common situations: 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.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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