quarkusio/quarkus · error · RuntimeException

invalid config ${line}

Error message

invalid config  ${line}

What it means

When JBang dev mode launches, getConfigurationProperties() reads application properties embedded in a Java source file. Lines starting with the marker //Q:CONFIG must be of the form 'key=value'; if no '=' is found after the marker, the launcher treats the line as invalid configuration and throws. This guards against typos in inline JBang configuration directives.

Source

Thrown at independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/jbang/JBangDevModeLauncherImpl.java:190

            byte[] buf = new byte[10];
            int r;
            while ((r = in.read(buf)) > 0) {
                out.write(buf, 0, r);
            }
            return new String(out.toByteArray(), StandardCharsets.UTF_8);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    private static Properties getConfigurationProperties(final Path source) throws IOException {
        Properties properties = new Properties();
        for (String line : Files.readAllLines(source)) {
            if (line.startsWith("//Q:CONFIG")) {
                String conf = line.substring(10).trim();
                int equals = conf.indexOf("=");
                if (equals == -1) {
                    throw new RuntimeException("invalid config  " + line);
                }
                properties.setProperty(conf.substring(0, equals), conf.substring(equals + 1));
            }
        }
        return properties;
    }
}

View on GitHub (pinned to e1c734241f)

Solutions

  1. Open the JBang script and find the offending line (it is included in the message) and add the missing '=' and value, e.g. //Q:CONFIG quarkus.package.type=uber-jar
  2. If the line was meant as a comment, remove or change the //Q:CONFIG prefix so it is not parsed as config
  3. Run the app via a regular application.properties instead of inline //Q:CONFIG directives to avoid parser fragility

Example fix

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

Strategy: validation

Validate before calling

List<String> lines = Files.readAllLines(source);
for (String line : lines) {
    if (line.startsWith("//Q:CONFIG")) {
        String conf = line.substring(10).trim();
        if (!conf.contains("=")) {
            throw new IllegalStateException("Malformed JBang config line (missing '='): " + line);
        }
    }
}

Try / catch

try {
    Properties props = launcher.configurationProperties();
} catch (RuntimeException e) {
    if (e.getMessage() != null && e.getMessage().startsWith("invalid config")) {
        // surface the offending line to the user, then abort or fall back to application.properties
    }
}

Prevention

When it happens

Trigger: A line in a JBang script starts with //Q:CONFIG but contains no '=' character, e.g. '//Q:CONFIG quarkus.datasource.db-kind' without the value part. Thrown from getConfigurationProperties, called by configurationProperties during JBang dev mode startup.

Common situations: Hand-editing //Q:CONFIG lines in a JBang single-file Quarkus app and deleting the value or the equals sign; copy/paste dropping the '=...' portion; writing a comment-like directive that accidentally starts with //Q:CONFIG but is not real config.

Related errors


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