{"record":{"id":"9833d43f93397740","repo":"NationalSecurityAgency/ghidra","slug":"server-is-already-started","errorCode":null,"errorMessage":"Server is already started","messagePattern":"Server is already started","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"warning","filePath":"Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/service/tracermi/TraceRmiPlugin.java","lineNumber":146,"sourceCode":"\t\tif (server != null) {\n\t\t\t// In case serverAddress is ephemeral, get its actual address\n\t\t\treturn server.getAddress();\n\t\t}\n\t\treturn serverAddress;\n\t}\n\n\t@Override\n\tpublic void setServerAddress(SocketAddress serverAddress) {\n\t\tif (server != null) {\n\t\t\tthrow new IllegalStateException(\"Cannot change server address while it is started\");\n\t\t}\n\t\tthis.serverAddress = serverAddress;\n\t}\n\n\t@Override\n\tpublic void startServer() throws IOException {\n\t\tif (server != null) {\n\t\t\tthrow new IllegalStateException(\"Server is already started\");\n\t\t}\n\t\tserver = new TraceRmiServer(this, serverAddress);\n\t\tserver.start();\n\t\tlisteners.invoke().serverStarted(server.getAddress());\n\t}\n\n\t@Override\n\tpublic void stopServer() {\n\t\tif (server != null) {\n\t\t\tserver.close();\n\t\t\tserver = null;\n\t\t\tlisteners.invoke().serverStopped();\n\t\t}\n\t}\n\n\t@Override\n\tpublic boolean isServerStarted() {\n\t\treturn server != null;","sourceCodeStart":128,"sourceCodeEnd":164,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/service/tracermi/TraceRmiPlugin.java#L128-L164","documentation":"Thrown by TraceRmiPlugin.startServer() when a server is already running (the `server` field is non-null). Only one TraceRmi server may be active at a time per plugin; you must stop the existing server before starting a new one or before changing the address.","triggerScenarios":"Calling startServer() twice without stopServer() in between; calling startServer() after it was already invoked successfully in the same plugin/tool lifecycle.","commonSituations":"Plugin UI/script invoking 'start server' twice; previous stopServer() failed or was skipped; lifecycle code that assumes start is idempotent.","solutions":["Call stopServer() (or check isServerStarted() returns false) before startServer().","Guard with isServerStarted(): only start when it returns false.","If you want a different address, stop the server first, call setServerAddress, then start."],"exampleFix":"// before\nplugin.startServer(); // again\n\n// after\nif (plugin.isServerStarted()) {\n    plugin.stopServer();\n}\nplugin.setServerAddress(addr);\nplugin.startServer();","handlingStrategy":"validation","validationCode":"if (plugin.isServerStarted()) {\n    plugin.stopServer();\n}\nplugin.startServer();","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Call stopServer() before startServer() or guard with isServerStarted().","Treat startServer as non-idempotent.","To change address, stop first, setServerAddress, then start."],"tags":["trace-rmi","server","lifecycle","validation"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}