NationalSecurityAgency/ghidra · error · RuntimeException
Port must be numeric
Error message
Port must be numeric
What it means
Thrown by ghidraTraceConnect when Integer.parseInt(addr[1]) raises NumberFormatException — the port portion of the host:port address is not a valid base-10 integer. This is a distinct, more specific error than the generic connect failure so the user knows the address shape was correct but the port was non-numeric.
Source
Thrown at Ghidra/Debug/Debugger-jpda/src/main/java/ghidra/dbg/jdi/rmi/jpda/JdiCommands.java:149
state = new State();
}
public void ghidraTraceConnect(String address) {
state.requireNoClient();
String[] addr = address.split(":");
if (addr.length != 2) {
throw new RuntimeException("Address must be in the form 'host:port'");
}
try {
SocketChannel channel =
SocketChannel.open(new InetSocketAddress(addr[0], Integer.parseInt(addr[1])));
state.client = new RmiClient(channel, "jdi");
state.client.setRegistry(connector.remoteMethodRegistry);
state.client.negotiate("Connect");
Msg.out("Connected to " + state.client.getDescription());
}
catch (NumberFormatException e) {
throw new RuntimeException("Port must be numeric");
}
catch (IOException e) {
throw new RuntimeException("Error connecting to " + address + ": " + e);
}
}
public void ghidraTraceListen(String address) {
// TODO: UNTESTED
state.requireNoClient();
String host = "127.0.0.1";
int port = 0;
if (address != null) {
String[] parts = address.split(":");
if (parts.length == 1) {
port = Integer.parseInt(parts[0]);
}
else {
host = parts[0];View on GitHub (pinned to d5f144c24d)
Solutions
- Ensure the port is a plain decimal integer in the valid range 0–65535, e.g. '127.0.0.1:12345'.
- Strip any whitespace or template artifacts from the address string before passing it.
- If the port comes from a variable, assert it is numeric (and in range) before calling ghidraTraceConnect.
Example fix
// before
ghidraTraceConnect("127.0.0.1:abc"); // throws 'Port must be numeric'
// after
int port = 12345;
ghidraTraceConnect("127.0.0.1:" + port); Defensive patterns
Strategy: validation
Validate before calling
String[] parts = address.split(":");
try {
int port = Integer.parseInt(parts[1]);
if (port < 0 || port > 65535) throw new IllegalArgumentException("Port out of range");
} catch (NumberFormatException e) {
// tell user the port is invalid before calling ghidraTraceConnect
} Prevention
- Parse and range-check the port before constructing the address string.
- Reject non-numeric port input in the UI/config layer.
- Avoid hex or suffix notation for ports.
When it happens
Trigger: Calling ghidraTraceConnect with a port like 'abc', '8080x', '12.5', or an empty port string. The host part passed the split(':' length==2 check, but the second segment is non-numeric.
Common situations: Typo in the port number; port specified in hex (0x1F90) which parseInt rejects; trailing whitespace or a non-printable character in the port string; a template variable was left unsubstituted producing a non-numeric value.
Related errors
- Address must be in the form 'host:port'
- Error connecting to ${address}: ${e}
- Transaction already started
- Attempt to create existing memory
- Timed out waiting for thread to stop
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/8a7efd0a115ccf43.
Report an issue: GitHub.