{"record":{"id":"363f7e08365d459e","repo":"NationalSecurityAgency/ghidra","slug":"could-not-start-server-363f7e","errorCode":null,"errorMessage":"Could not start server","messagePattern":"Could not start server","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"critical","filePath":"Ghidra/Debug/Debugger-isf/src/main/java/ghidra/dbg/isf/IsfServer.java","lineNumber":63,"sourceCode":"\tprivate GhidraProject project;\n\tprivate int port = 54321;\n\tprivate IsfClientHandler handler;\n\n\tprivate Map<String, DataTypeManager> managers = new HashMap<>();\n\n\tpublic IsfServer(GhidraProject project, int port) {\n\t\tthis.project = project;\n\t\tthis.port = port;\n\t\thandler = new IsfClientHandler(this);\n\t}\n\n\tpublic void startServer() {\n\t\ttry {\n\t\t\tserver = new ServerSocket(port, 50, InetAddress.getLoopbackAddress());\n\t\t\tthis.start();\n\t\t}\n\t\tcatch (IOException e) {\n\t\t\tthrow new RuntimeException(\"Could not start server\");\n\t\t}\n\t}\n\n\tpublic void stopServer() {\n\t\trunning = false;\n\t\tthis.interrupt();\n\t\tfor (DataTypeManager m : managers.values()) {\n\t\t\tm.close();\n\t\t}\n\t}\n\n\t@Override\n\tpublic void run() {\n\t\trunning = true;\n\t\twhile (running) {\n\t\t\ttry {\n\t\t\t\tMsg.info(this, \"Listening for a connection...\");\n","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Debugger-isf/src/main/java/ghidra/dbg/isf/IsfServer.java#L45-L81","documentation":"IsfServer.startServer wraps an IOException from new ServerSocket(port, 50, InetAddress.getLoopbackAddress()) in a RuntimeException('Could not start server'). The ISF server thread could not bind its loopback listener socket. Unlike the DAP variant, this binds to the loopback address and does not append the IOException message, so the underlying cause is only visible in the wrapped exception.","triggerScenarios":"startServer() is called when the configured port is already bound (e.g. another ISF server instance still running), or socket creation fails. Bind is to InetAddress.getLoopbackAddress() (127.0.0.1), so non-loopback/permission address issues are limited.","commonSituations":"A prior IsfServer was not stopped (stopServer sets running=false, interrupts the thread, closes managers but the ServerSocket close is not shown here); port collision with another loopback service; OS refusing socket allocation under resource exhaustion.","solutions":["Stop any previously started IsfServer (call stopServer() and ensure its ServerSocket is closed) before starting a new one.","Choose a different, free port for the ISF server.","Reproduce with a direct ServerSocket bind on loopback to capture the real IOException (BindException).","Wrap/propagate IOException instead of a bare RuntimeException so callers can react to the bind failure."],"exampleFix":"// before\ntry {\n    server = new ServerSocket(port, 50, InetAddress.getLoopbackAddress());\n    this.start();\n} catch (IOException e) {\n    throw new RuntimeException(\"Could not start server\");\n}\n\n// after\ntry {\n    server = new ServerSocket(port, 50, InetAddress.getLoopbackAddress());\n    this.start();\n} catch (IOException e) {\n    throw new RuntimeException(\"Could not start ISF server on loopback:\" + port, e);\n}","handlingStrategy":"try-catch","validationCode":"try (ServerSocket probe = new ServerSocket(port, 50, InetAddress.getLoopbackAddress())) {\n    // free; close probe and let IsfServer bind\n} catch (IOException e) {\n    // choose another port before startServer()\n}","typeGuard":null,"tryCatchPattern":"try {\n    server.startServer();\n} catch (RuntimeException e) {\n    // ISF server bind failed; stop prior instance and/or pick a new port\n}","preventionTips":["Call stopServer() and ensure the prior ServerSocket is closed before restarting.","Use a free loopback port for the ISF server.","Wrap the IOException so the real cause (BindException) is visible."],"tags":["network","server","socket","isf","bind","loopback"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}