quarkusio/quarkus · error · IllegalArgumentException

One of groupId or artifactId is missing from '${str.substrin

Error message

One of groupId or artifactId is missing from '${str.substring(0, fromIndex)}'

What it means

GACT.split throws IllegalArgumentException when the ':' immediately precedes the substring boundary, meaning one of groupId or artifactId is missing (the string starts with ':' or has '::' at the split point). The message includes the offending prefix substring.

Source

Thrown at independent-projects/bootstrap/app-model/src/main/java/io/quarkus/maven/dependency/GACT.java:104

            if (i == fromIndex - 1) {
                parts[2] = ArtifactCoords.DEFAULT_CLASSIFIER;
            } else {
                parts[2] = str.substring(i + 1, fromIndex);
            }

            fromIndex = i;
            i = str.lastIndexOf(':', fromIndex - 1);
            if (i < 0) {
                parts[0] = str.substring(0, fromIndex);
                if ((parts[1] = parts[2]).isEmpty()) {
                    throw new IllegalArgumentException("ArtifactId is empty in `" + str + "`");
                }
                parts[2] = parts[3];
                parts[3] = null;
                return parts;
            }
            if (i == fromIndex - 1) {
                throw new IllegalArgumentException(
                        "One of groupId or artifactId is missing from '" + str.substring(0, fromIndex) + "'");
            }

            parts[0] = str.substring(0, i);
            parts[1] = str.substring(i + 1, fromIndex);
            if (parts[3].isEmpty()) {
                parts[3] = null;
            }
            return parts;
        }

        parts[0] = str.substring(0, fromIndex);
        if ((parts[1] = parts[3]).isEmpty()) {
            throw new IllegalArgumentException("ArtifactId is empty in `" + str + "`");
        }
        parts[2] = ArtifactCoords.DEFAULT_CLASSIFIER;
        parts[3] = null;
        return parts;

View on GitHub (pinned to e1c734241f)

Solutions

  1. Ensure the prefix before the parsed segment is exactly groupId:artifactId with both non-empty
  2. Collapse or fix double/leading colons in the coordinate string
  3. Pre-validate that str.charAt(0) != ':' and the string contains no "::"

Example fix

// before
GACT.split(":app:1.0.0", new String[5], 8); // throws
// after
GACT.split("com.acme:app:1.0.0", new String[5], 14);
Defensive patterns

Strategy: validation

Validate before calling

boolean hasGa(String s) {
    return s != null && s.charAt(0) != ':' && !s.contains("::");
}

Try / catch

try {
    GACT.split(str, parts, fromIndex);
} catch (IllegalArgumentException e) {
    if (e.getMessage().startsWith("One of groupId or artifactId is missing")) {
        throw new IllegalArgumentException("Coordinate must start with groupId:artifactId: " + str);
    }
}

Prevention

When it happens

Trigger: Calling GACT.split with input like ":app:1.0" or "com.acme:::..." where the character just before fromIndex is ':' — leaving either the groupId or artifactId slot empty.

Common situations: Coords with a leading colon copied from CLI output; consecutive colons from joining an empty variable; typos when hand-editing quarkus dependency configuration.

Related errors


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