NationalSecurityAgency/ghidra · warning · IllegalStateException

Server is already started

Error message

Server is already started

What it means

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.

Source

Thrown at Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/service/tracermi/TraceRmiPlugin.java:146

		if (server != null) {
			// In case serverAddress is ephemeral, get its actual address
			return server.getAddress();
		}
		return serverAddress;
	}

	@Override
	public void setServerAddress(SocketAddress serverAddress) {
		if (server != null) {
			throw new IllegalStateException("Cannot change server address while it is started");
		}
		this.serverAddress = serverAddress;
	}

	@Override
	public void startServer() throws IOException {
		if (server != null) {
			throw new IllegalStateException("Server is already started");
		}
		server = new TraceRmiServer(this, serverAddress);
		server.start();
		listeners.invoke().serverStarted(server.getAddress());
	}

	@Override
	public void stopServer() {
		if (server != null) {
			server.close();
			server = null;
			listeners.invoke().serverStopped();
		}
	}

	@Override
	public boolean isServerStarted() {
		return server != null;

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Call stopServer() (or check isServerStarted() returns false) before startServer().
  2. Guard with isServerStarted(): only start when it returns false.
  3. If you want a different address, stop the server first, call setServerAddress, then start.

Example fix

// before
plugin.startServer(); // again

// after
if (plugin.isServerStarted()) {
    plugin.stopServer();
}
plugin.setServerAddress(addr);
plugin.startServer();
Defensive patterns

Strategy: validation

Validate before calling

if (plugin.isServerStarted()) {
    plugin.stopServer();
}
plugin.startServer();

Prevention

When it happens

Trigger: Calling startServer() twice without stopServer() in between; calling startServer() after it was already invoked successfully in the same plugin/tool lifecycle.

Common situations: Plugin UI/script invoking 'start server' twice; previous stopServer() failed or was skipped; lifecycle code that assumes start is idempotent.

Related errors


AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14). Data as JSON: /api/errors/9833d43f93397740. Report an issue: GitHub.