NationalSecurityAgency/ghidra · error · RuntimeException
Not connected
Error message
Not connected
What it means
RuntimeException('Not connected') thrown by State.requireClient() when the JdiCommands client field is null. Most JDI commands route through requireClient() to obtain the RmiClient before issuing a JDWP/JDI operation, so any command issued before connect() fails here. It is a state precondition guard.
Source
Thrown at Ghidra/Debug/Debugger-jpda/src/main/java/ghidra/dbg/jdi/rmi/jpda/JdiCommands.java:65
/*
* Some notes:
* ghidraTracePutX: batch wrapper around putXxxx
* putX: generally creates the object and calls putXDetails
* putXDetails: assumes the object already exists
* putXContainer: creates one or more objects
* xProxy: container for exactly one X
*/
class State {
public RmiClient client;
public RmiTrace trace;
RmiTransaction tx;
public RmiClient requireClient() {
if (client == null) {
throw new RuntimeException("Not connected");
}
return client;
}
public void requireNoClient() {
if (client != null) {
client = null;
throw new RuntimeException("Already connected");
}
}
public void resetClient() {
client = null;
resetTrace();
}
public RmiTrace requireTrace() {
if (trace == null) {View on GitHub (pinned to d5f144c24d)
Solutions
- Call the connect command first and confirm it succeeded before any client-requiring command.
- Guard by checking state.client != null (or catching RuntimeException) before invoking client-requiring commands.
- After a disconnect/reset, re-establish the connection before continuing the command sequence.
Example fix
// before
state.requireClient().someCommand();
// after
if (state.client == null) {
throw new IllegalStateException("Connect to the target before issuing JDI commands");
}
state.requireClient().someCommand(); Defensive patterns
Strategy: validation
Validate before calling
if (state.client == null) {
throw new IllegalStateException("Connect to the target first");
}
state.requireClient().someCommand(); Try / catch
try {
state.requireClient();
} catch (RuntimeException e) {
if ("Not connected".equals(e.getMessage())) {
// run connect first
}
} Prevention
- Always connect before issuing client-requiring JDI commands.
- Check state.client != null as a precondition in command scripts.
- Reconnect after a disconnect/reset.
When it happens
Trigger: Issuing a JDI command that needs an active connection (anything calling requireClient()) before State.client has been set by a successful connect. Examples: running trace/step/refresh commands without first connecting to the target VM.
Common situations: Script/command sequence that skips the connect step; connect failed earlier and resetClient() nullified client; misordered commands after a disconnect.
Related errors
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/16b357ead3465948.
Report an issue: GitHub.