quarkusio/quarkus · error · IllegalArgumentException

Invalid workspace module ID string: ${str}

Error message

Invalid workspace module ID string: ${str}

What it means

WorkspaceModuleId.fromString parses a colon-separated string and throws IllegalArgumentException if it does not split into exactly 3 parts (groupId:artifactId:version). The library requires the strict GAV form for module ids.

Source

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

package io.quarkus.bootstrap.workspace;

import io.quarkus.maven.dependency.GAV;

public interface WorkspaceModuleId {

    static WorkspaceModuleId of(String groupId, String artifactId, String version) {
        return new GAV(groupId, artifactId, version);
    }

    static WorkspaceModuleId fromString(String str) {
        final String[] arr = str.split(":");
        if (arr.length != 3) {
            throw new IllegalArgumentException("Invalid workspace module ID string: " + str);
        }
        return of(arr[0], arr[1], arr[2]);
    }

    String getGroupId();

    String getArtifactId();

    String getVersion();
}

View on GitHub (pinned to e1c734241f)

Solutions

  1. Pass exactly groupId:artifactId:version with two ':' separators
  2. If your input has classifier/type, strip the extra segments before calling fromString
  3. Validate with a split(':').length == 3 check before calling

Example fix

// before
WorkspaceModuleId id = WorkspaceModuleId.fromString("com.acme:app"); // throws
// after
WorkspaceModuleId id = WorkspaceModuleId.fromString("com.acme:app:1.0.0");
Defensive patterns

Strategy: validation

Validate before calling

boolean isValidModuleId(String s) {
    return s != null && s.split(":", -1).length == 3;
}

Type guard

Optional<WorkspaceModuleId> tryParseModuleId(String s) {
    String[] a = s == null ? new String[0] : s.split(":", -1);
    return a.length == 3
        ? Optional.of(WorkspaceModuleId.of(a[0], a[1], a[2]))
        : Optional.empty();
}

Try / catch

try {
    id = WorkspaceModuleId.fromString(str);
} catch (IllegalArgumentException e) {
    throw new IllegalArgumentException("Expected groupId:artifactId:version, got: " + str, e);
}

Prevention

When it happens

Trigger: Calling WorkspaceModuleId.fromString(str) where str contains fewer or more than two ':' characters, e.g. "com.acme:app" or "com.acme:app:1.0:extra".

Common situations: Reading module ids from config files or environment variables with typos; passing Maven artifact strings that include classifier/type (5 segments) instead of the 3-segment GAV; trimming or joining errors when composing the string.

Related errors


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