oracle/graal · error · IllegalArgumentException

Invalid JDWP option, address: {value}. Port is not a number.

Error message

Invalid JDWP option, address: {value}. Port is not a number. Must be a number in the 0 - 65535 range.

What it means

While parsing the JDWP 'address' value, the substring after ':' is parsed with Long.valueOf; a NumberFormatException (non-numeric port text) is converted into this IllegalArgumentException telling the user the port must be a number in 0-65535.

Source

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

                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.");
                                }
                            } catch (NumberFormatException ex) {
                                throw new IllegalArgumentException("Invalid JDWP option, address: " + value + ". Port is not a number. Must be a number in the 0 - 65535 range.");
                            }
                            inputPort = (int) realValue;
                        }
                        host = inputHost;
                        port = inputPort;
                        break;
                    case "transport":
                        if (!"dt_socket".equals(value)) {
                            throw new IllegalArgumentException("Invalid transport " + value + ". Espresso only supports dt_socket currently.");
                        }
                        transport = value;
                        break;
                    case "server":
                        server = yesOrNo(key, value);
                        break;
                    case "suspend":
                        suspend = yesOrNo(key, value);
                        break;

View on GitHub (pinned to a66e9ccd1d)

Solutions

  1. Format the address as [<host>:]<port> with a purely numeric port, e.g. address=:8000.
  2. For IPv6, use the bracketed host form supported by your platform's JDWP or bind via hostname.
  3. Strip whitespace and placeholder text from generated option strings.

Example fix

# before
--java.JDWPOptions=transport=dt_socket,address=localhost:PORT_PLACEHOLDER

# after
--java.JDWPOptions=transport=dt_socket,address=localhost:8000
Defensive patterns

Strategy: validation

Validate before calling

if (!portStr.chars().allMatch(Character::isDigit)) throw new ConfigException("Port must be numeric");

Type guard

static boolean numericPort(String p) { return p != null && p.matches("\\d+"); }

Prevention

When it happens

Trigger: --java.JDWPOptions=...,address=localhost:jdwp or address=host:8000extra or an IPv6-looking value whose colons make the port substring non-numeric.

Common situations: Passing hostnames with colons or IPv6 addresses (unsupported format); stale placeholder text left in the address; extra characters after the port from copy-paste.

Related errors


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