NationalSecurityAgency/ghidra · error · RuntimeException
Address must be in the form 'host:port'
Error message
Address must be in the form 'host:port'
What it means
Thrown by ghidraTraceConnect(String address) when the supplied address string does not split into exactly two colon-separated parts. The method naively splits on ':' and requires host and port; this means any address missing the port, missing the host, containing extra colons, or using IPv6 syntax (which itself contains colons) will be rejected before any socket is opened.
Source
Thrown at Ghidra/Debug/Debugger-jpda/src/main/java/ghidra/dbg/jdi/rmi/jpda/JdiCommands.java:138
private JdiConnector connector;
private JdiManagerImpl jdi;
public State state;
private String[] regNames = { "PC", "return_address" };
public long MAX_REFS = 100;
public JdiCommands(JdiConnector connector) {
this.connector = connector;
this.jdi = connector.getJdi();
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) {View on GitHub (pinned to d5f144c24d)
Solutions
- Provide the address in strict 'host:port' form, e.g. '127.0.0.1:12345'.
- If targeting IPv6, note this parser does not support bracketed notation — connect via an IPv4 address or a hostname that resolves to one.
- Validate the address string before calling ghidraTraceConnect: ensure it contains exactly one ':' and both halves are non-empty.
Example fix
// before
ghidraTraceConnect("localhost"); // throws
// after
ghidraTraceConnect("127.0.0.1:12345"); Defensive patterns
Strategy: validation
Validate before calling
void connectSafe(String address) {
String[] parts = address.split(":");
if (parts.length != 2 || parts[0].isEmpty() || parts[1].isEmpty()) {
throw new IllegalArgumentException("Address must be 'host:port'");
}
ghidraTraceConnect(address);
} Try / catch
try { ghidraTraceConnect(address); }
catch (RuntimeException e) {
if (e.getMessage().contains("host:port")) { /* re-prompt user for address */ }
else throw e;
} Prevention
- Pre-validate address strings with a host:port regex before passing to ghidraTraceConnect.
- Avoid IPv6 literals with this API; resolve to IPv4 first.
- Centralize address construction so the format contract is enforced in one place.
When it happens
Trigger: Calling ghidraTraceConnect("localhost") (no port), ghidraTraceConnect(":8080") (no host), ghidraTraceConnect("a:b:c") (extra colons), or any IPv6 address like "::1:8080" which splits into more than two parts.
Common situations: User omits the port assuming a default; copy-pasting an IPv6 loopback address; a launch configuration passes a bare hostname; the address string was constructed programmatically without enforcing the host:port contract.
Related errors
- Port must be numeric
- 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/469a7f5090ab4455.
Report an issue: GitHub.