quarkusio/quarkus · error

invalid config ${comment}

Error message

invalid config  ${comment}

What it means

JBangIntegration.postBuild processes //Q:CONFIG name=value comments used to inject configuration properties during JBang-based builds. This error is thrown when a Q:CONFIG comment lacks an '=' separator, so it cannot be split into a key and value.

Source

Thrown at core/launcher/src/main/java/io/quarkus/launcher/JBangIntegration.java:57

                dataOutputStream.writeUTF(i.getKey());
                dataOutputStream.writeUTF(i.getValue().toAbsolutePath().toString());
            }
            dataOutputStream.close();
            files.put("jbang-dev.dat", outputStream.toByteArray());
            HashMap<String, Object> ret = new HashMap<>();
            ret.put("files", files);
            ret.put("main-class", "io.quarkus.launcher.JBangDevModeLauncher");
            return ret;
        }

        Properties configurationProperties = new Properties();
        for (String comment : comments) {
            //we allow config to be provided via //Q:CONFIG name=value
            if (comment.startsWith(CONFIG)) {
                String conf = comment.substring(CONFIG.length()).trim();
                int equals = conf.indexOf("=");
                if (equals == -1) {
                    throw new RuntimeException("invalid config  " + comment);
                }
                configurationProperties.setProperty(conf.substring(0, equals), conf.substring(equals + 1));
            }
        }

        //huge hack
        //jbang does not consider the pom when resolving dependencies
        //so can get the wrong version of asm
        //we remove it from the deps list so we can use the correct one
        List<Map.Entry<String, Path>> dependencies = new ArrayList<>();
        for (Map.Entry<String, Path> i : originalDeps) {
            if (!i.getKey().startsWith("org.ow2.asm:asm:")) {
                dependencies.add(i);
            }
        }

        ClassLoader old = Thread.currentThread().getContextClassLoader();
        try {

View on GitHub (pinned to e1c734241f)

Solutions

  1. Fix the comment to the form //Q:CONFIG name=value (must contain '=')
  2. Remove the malformed Q:CONFIG comment if config is supplied another way (-Dquarkus.args or application.properties)
  3. Verify no stray characters between CONFIG marker and the property name

Example fix

// before
//Q:CONFIG quarkus.package.type
// after
//Q:CONFIG quarkus.package.type=uber-jar
Defensive patterns

Strategy: validation

Validate before calling

for (String comment : comments) {
    if (comment.startsWith("//Q:CONFIG") && !comment.substring(comment.indexOf("Q:CONFIG") + 8).trim().contains("=")) {
        throw new IllegalArgumentException("Malformed Q:CONFIG (missing =): " + comment);
    }
}

Try / catch

try {
    jbangIntegration.postBuild(...);
} catch (RuntimeException e) {
    if (e.getMessage() != null && e.getMessage().startsWith("invalid config")) {
        log.error("Fix the //Q:CONFIG comment: " + e.getMessage());
    }
    throw e;
}

Prevention

When it happens

Trigger: A source file compiled via JBang contains a comment like //Q:CONFIG foo (no =value) or //Q:CONFIG name=value with the marker matched but no '=' anywhere after CONFIG prefix; postBuild then throws while parsing comments.

Common situations: Typos in a Q:CONFIG directive in a .java file run via JBang; writing //Q:CONFIG to disable a property but forgetting the =-value syntax; copy-pasted comments with malformed format.

Related errors


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