quarkusio/quarkus · error · IllegalArgumentException

Invalid CodestartDep expression: + expression

Error message

Invalid CodestartDep expression: + expression

What it means

CodestartDep is parsed from a Maven-style 'groupId:artifactId[:version]' string expression via a Jackson @JsonCreator. This error means the expression had fewer than two colon-separated parts, so no group/artifact coordinates could be extracted. It is an IllegalArgumentException from malformed codestart YAML data.

Source

Thrown at independent-projects/tools/codestarts/src/main/java/io/quarkus/devtools/codestarts/core/CodestartSpec.java:141

        }
    }

    public static class CodestartDep extends HashMap<String, String> {

        private static final String GROUP_ID = "groupId";
        private static final String ARTIFACT_ID = "artifactId";
        private static final String VERSION = "version";
        private static final String FORMATTED_GAV = "formatted-gav";
        private static final String FORMATTED_GA = "formatted-ga";

        public CodestartDep() {
        }

        @JsonCreator(mode = JsonCreator.Mode.DELEGATING)
        public CodestartDep(final String expression) {
            final String[] split = expression.split(":");
            if (split.length < 2) {
                throw new IllegalArgumentException("Invalid CodestartDep expression: " + expression);
            }
            this.put(GROUP_ID, split[0]);
            this.put(ARTIFACT_ID, split[1]);

            if (split.length == 3) {
                this.put(VERSION, split[2]);
                this.put(FORMATTED_GA, split[0] + ":" + split[1]);
            } else {
                this.put(FORMATTED_GA, expression);
            }
            this.put(FORMATTED_GAV, expression);

        }

        public String getGroupId() {
            return this.get(GROUP_ID);
        }

View on GitHub (pinned to e1c734241f)

Solutions

  1. Write the dependency as groupId:artifactId (version optional): e.g. io.quarkus:quarkus-jdbc-postgresql
  2. Quote the expression in YAML ('"com.example:lib:1.0"') so colon parsing is preserved
  3. Validate the codestart YAML dependencies entries before loading

Example fix

# before
dependencies:
  - quarkus-jdbc-postgresql
# after
dependencies:
  - "io.quarkus:quarkus-jdbc-postgresql"
Defensive patterns

Strategy: validation

Validate before calling

if (expr == null || expr.split(":").length < 2)
    throw new IllegalArgumentException("Dep must be groupId:artifactId[:version]");

Type guard

boolean isDepExpr(Object v) { return v instanceof String && ((String) v).split(":").length >= 2; }

Try / catch

try { mapper.readValue(yaml, CodestartSpec.class); }
catch (IllegalArgumentException e) {
    if (e.getMessage().startsWith("Invalid CodestartDep expression")) { /* fix entry */ } else throw e;
}

Prevention

When it happens

Trigger: A codestart YAML 'dependencies' entry contains a single token without ':' (e.g. just an artifact name), and Jackson deserializes the codestart spec into CodestartDep.

Common situations: Hand-written codestart dependency lists with shorthand names; missing version produced ':' splitting issues; copy-paste of dependency strings into YAML without quoting (leading YAML to strip structure) — note also YAML specials like ':' need quoting.

Related errors


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