{"record":{"id":"94e74573913543c1","repo":"NationalSecurityAgency/ghidra","slug":"error-connecting-to-address-e","errorCode":null,"errorMessage":"Error connecting to ${address}: ${e}","messagePattern":"Error connecting to (.+?): (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"Ghidra/Debug/Debugger-jpda/src/main/java/ghidra/dbg/jdi/rmi/jpda/JdiCommands.java","lineNumber":152,"sourceCode":"\tpublic void ghidraTraceConnect(String address) {\n\t\tstate.requireNoClient();\n\t\tString[] addr = address.split(\":\");\n\t\tif (addr.length != 2) {\n\t\t\tthrow new RuntimeException(\"Address must be in the form 'host:port'\");\n\t\t}\n\t\ttry {\n\t\t\tSocketChannel channel =\n\t\t\t\tSocketChannel.open(new InetSocketAddress(addr[0], Integer.parseInt(addr[1])));\n\t\t\tstate.client = new RmiClient(channel, \"jdi\");\n\t\t\tstate.client.setRegistry(connector.remoteMethodRegistry);\n\t\t\tstate.client.negotiate(\"Connect\");\n\t\t\tMsg.out(\"Connected to \" + state.client.getDescription());\n\t\t}\n\t\tcatch (NumberFormatException e) {\n\t\t\tthrow new RuntimeException(\"Port must be numeric\");\n\t\t}\n\t\tcatch (IOException e) {\n\t\t\tthrow new RuntimeException(\"Error connecting to \" + address + \": \" + e);\n\t\t}\n\t}\n\n\tpublic void ghidraTraceListen(String address) {\n\t\t// TODO: UNTESTED\n\t\tstate.requireNoClient();\n\t\tString host = \"127.0.0.1\";\n\t\tint port = 0;\n\t\tif (address != null) {\n\t\t\tString[] parts = address.split(\":\");\n\t\t\tif (parts.length == 1) {\n\t\t\t\tport = Integer.parseInt(parts[0]);\n\t\t\t}\n\t\t\telse {\n\t\t\t\thost = parts[0];\n\t\t\t\tport = Integer.parseInt(parts[1]);\n\t\t\t}\n\t\t}","sourceCodeStart":134,"sourceCodeEnd":170,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Debugger-jpda/src/main/java/ghidra/dbg/jdi/rmi/jpda/JdiCommands.java#L134-L170","documentation":"Thrown by ghidraTraceConnect when SocketChannel.open(InetSocketAddress) or the subsequent RmiClient construction/negotiation raises an IOException. The original exception's message is appended so the underlying cause (connection refused, DNS failure, unreachable host) is visible.","triggerScenarios":"The Ghidra Trace RMI server is not listening on the given host/port; the host is unreachable or does not resolve; a firewall drops the connection; the RMI handshake (negotiate) fails because the server speaks a different protocol version.","commonSituations":"The debugger back-end was never started or crashed before Ghidra connected; wrong host/port in the launch offer; the target is on a different network/VPN; a stale acceptor socket; version mismatch between the JDI agent and the Ghidra Trace RMI plugin.","solutions":["Verify the Trace RMI server is running and listening on the specified host:port (e.g., check the back-end terminal output for the bound port).","Confirm network reachability: test with a TCP connection or ping to the host.","Check that no firewall is blocking the port and that the host name resolves correctly.","Ensure the JDI agent and Ghidra plugin versions match to avoid negotiate() protocol failures."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Pre-check reachability (best effort)\ntry (java.net.Socket s = new java.net.Socket()) {\n    s.connect(new InetSocketAddress(host, port), 1000);\n} catch (IOException e) { /* warn user before ghidraTraceConnect */ }","typeGuard":null,"tryCatchPattern":"try { ghidraTraceConnect(address); }\ncatch (RuntimeException e) {\n    if (e.getMessage().startsWith(\"Error connecting\")) { /* surface the cause, offer retry */ }\n    else throw e;\n}","preventionTips":["Confirm the Trace RMI server is started and listening before connecting.","Keep host/port in a single validated config source.","Match JDI agent and Ghidra plugin versions to avoid negotiate() failures."],"tags":["network","connection-failure","jdi","ghidra-debug"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}