{"record":{"id":"16b357ead3465948","repo":"NationalSecurityAgency/ghidra","slug":"not-connected-16b357","errorCode":null,"errorMessage":"Not connected","messagePattern":"Not connected","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"Ghidra/Debug/Debugger-jpda/src/main/java/ghidra/dbg/jdi/rmi/jpda/JdiCommands.java","lineNumber":65,"sourceCode":"\n/*\n * Some notes:\n * \t\tghidraTracePutX:  batch wrapper around putXxxx\n * \t\tputX:  generally creates the object and calls putXDetails\n * \t\tputXDetails:  assumes the object already exists\n * \t\tputXContainer:  creates one or more objects\n * \t\txProxy:  container for exactly one X\n */\n\nclass State {\n\n\tpublic RmiClient client;\n\tpublic RmiTrace trace;\n\tRmiTransaction tx;\n\n\tpublic RmiClient requireClient() {\n\t\tif (client == null) {\n\t\t\tthrow new RuntimeException(\"Not connected\");\n\t\t}\n\t\treturn client;\n\t}\n\n\tpublic void requireNoClient() {\n\t\tif (client != null) {\n\t\t\tclient = null;\n\t\t\tthrow new RuntimeException(\"Already connected\");\n\t\t}\n\t}\n\n\tpublic void resetClient() {\n\t\tclient = null;\n\t\tresetTrace();\n\t}\n\n\tpublic RmiTrace requireTrace() {\n\t\tif (trace == null) {","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Debugger-jpda/src/main/java/ghidra/dbg/jdi/rmi/jpda/JdiCommands.java#L47-L83","documentation":"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.","triggerScenarios":"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.","commonSituations":"Script/command sequence that skips the connect step; connect failed earlier and resetClient() nullified client; misordered commands after a disconnect.","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."],"exampleFix":"// before\nstate.requireClient().someCommand();\n\n// after\nif (state.client == null) {\n    throw new IllegalStateException(\"Connect to the target before issuing JDI commands\");\n}\nstate.requireClient().someCommand();","handlingStrategy":"validation","validationCode":"if (state.client == null) {\n    throw new IllegalStateException(\"Connect to the target first\");\n}\nstate.requireClient().someCommand();","typeGuard":null,"tryCatchPattern":"try {\n    state.requireClient();\n} catch (RuntimeException e) {\n    if (\"Not connected\".equals(e.getMessage())) {\n        // run connect first\n    }\n}","preventionTips":["Always connect before issuing client-requiring JDI commands.","Check state.client != null as a precondition in command scripts.","Reconnect after a disconnect/reset."],"tags":["ghidra","jdi","jpda","state-machine","validation"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}