oracle/graal · error · IllegalArgumentException

JDWP options must be a comma separated list of key=value pai

Error message

JDWP options must be a comma separated list of key=value pairs.

What it means

The JDWPOptions converter splits the option value on commas and requires each token to contain '=' at index > 0 (a non-empty key followed by a value). A token without '=', or starting with '=' (empty key), fails this check.

Source

Thrown at espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/EspressoOptions.java:417

            if (!"y".equals(value) && !"n".equals(value)) {
                throw new IllegalArgumentException("Invalid JDWP option value: " + key + " can be only 'y' or 'n'.");
            }
            return "y".equals(value);
        }

        @Override
        public JDWPOptions apply(String s) {
            final String[] options = s.split(",");
            String transport = null;
            String host = null;
            int port = 0;
            boolean server = false;
            boolean suspend = true;

            for (String keyValue : options) {
                int equalsIndex = keyValue.indexOf('=');
                if (equalsIndex <= 0) {
                    throw new IllegalArgumentException("JDWP options must be a comma separated list of key=value pairs.");
                }
                String key = keyValue.substring(0, equalsIndex);
                String value = keyValue.substring(equalsIndex + 1);
                switch (key) {
                    case "address":
                        String inputHost = null;
                        int inputPort = 0;
                        if (!value.isEmpty()) {
                            int colonIndex = value.indexOf(':');
                            if (colonIndex > 0) {
                                inputHost = value.substring(0, colonIndex);
                            }
                            String portStr = value.substring(colonIndex + 1);
                            long realValue;
                            try {
                                realValue = Long.valueOf(portStr);
                                if (realValue < 0 || realValue > 65535) {
                                    throw new IllegalArgumentException("Invalid JDWP option, address: " + value + ". Must be in the 0 - 65535 range.");

View on GitHub (pinned to a66e9ccd1d)

Solutions

  1. Ensure every token is key=value separated by commas: transport=dt_socket,server=y,suspend=n.
  2. Remove trailing/leading commas and bare flags.
  3. Quote the whole option in the shell to prevent word splitting.

Example fix

# before
--java.JDWPOptions=transport=dt_socket,server=y,

# after
--java.JDWPOptions=transport=dt_socket,server=y
Defensive patterns

Strategy: validation

Validate before calling

for (String kv : opts.split(",", -1)) {
    int i = kv.indexOf('=');
    if (i <= 0 || kv.substring(i + 1).isEmpty() && !kv.endsWith("=")) {
        // strict check: key non-empty, '=' present
    }
    if (i <= 0) throw new ConfigException("Malformed JDWP token: " + kv);
}

Type guard

static boolean wellFormedJdwp(String s) {
    for (String kv : s.split(",", -1)) {
        int i = kv.indexOf('=');
        if (i <= 0) return false;
    }
    return true;
}

Prevention

When it happens

Trigger: Passing --java.JDWPOptions=transport=dt_socket;server=y (semicolon separators), a trailing comma, a bare flag like 'suspend', or a leading '='.

Common situations: Shell quoting mistakes that eat the '='; using ';' or space separators as some JDWP docs show; trailing commas from programmatically joining an option list.

Related errors


AI-assisted analysis of oracle/graal@a66e9ccd1d (2026-08-14). Data as JSON: /api/errors/da35e468fee1e6ab. Report an issue: GitHub.