{"record":{"id":"7fa3d5f776d31013","repo":"NationalSecurityAgency/ghidra","slug":"bsim-server-has-not-been-specified","errorCode":null,"errorMessage":"BSim server has not been specified","messagePattern":"BSim server has not been specified","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/ingest/BulkSignatures.java","lineNumber":95,"sourceCode":"\t\t\t\t\tbsimServerInfo.getDBName());\n\t\t\t}\n\t\t}\n\t\tthis.bsimServerInfo = bsimServerInfo;\n\t}\n\n\t/**\n\t * Constructor\n\t * @param bsimServerInfo the BSim database server info.  May be {@code null} if use limited to\n\t * signature and update generation only (based upon configuration template).  If specified, \n\t * this object will convey the connecting user name.\n\t */\n\tpublic BulkSignatures(BSimServerInfo bsimServerInfo) {\n\t\tthis.bsimServerInfo = bsimServerInfo;\n\t}\n\n\tprivate void checkBSimServerOperation() {\n\t\tif (bsimServerInfo == null) {\n\t\t\tthrow new UnsupportedOperationException(\"BSim server has not been specified\");\n\t\t}\n\t}\n\n\t/**\n\t *\n\t * \n\t * @param async true if database commits should be synchronous\n\t * @return  the {@link DatabaseInformation} object returned from a successful connect\n\t * @throws IOException if there's a problem creating the connection\n\t */\n\tprivate DatabaseInformation establishQueryServerConnection(boolean async) throws IOException {\n\n\t\tif (querydb != null) {\n\t\t\treturn querydb.getInfo();\n\t\t}\n\n\t\tcheckBSimServerOperation();\n","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/ingest/BulkSignatures.java#L77-L113","documentation":"Thrown by BulkSignatures.checkBSimServerOperation whenever a server-dependent operation is attempted but the BulkSignatures instance was constructed with a null BSimServerInfo. The constructor explicitly permits a null server info for the limited use case of generating signatures/updates offline against a configuration template; any operation that needs to talk to a live server calls checkBSimServerOperation first and this guard fails fast with UnsupportedOperationException.","triggerScenarios":"Constructing new BulkSignatures(null) (template-only mode) and then calling a method that routes through establishQueryServerConnection or otherwise needs the server: doDumpSigs against a remote, sendSignaturesToServer, sendUpdateToServer, createDatabase, dropDatabase, deleteExecutable, dropIndex, rebuildIndex, prewarm, getexeinfo, installMetadata, installCategory, etc.","commonSituations":"Reusing a signature-generation BulkSignatures handle for a server command; misconfiguration where the BSim server URL/BSimServerInfo was never resolved from properties; headless tool invoked with 'generatesigs' but then a server command appended.","solutions":["Pass a non-null BSimServerInfo (built from the configured BSim URL) into new BulkSignatures(...) before issuing server commands.","Split the workflow: use the null-server handle only for local signature/update generation, then build a new BulkSignatures with a server for ingest.","Verify the BSim server URL is set in your launch properties/configuration before constructing BulkSignatures."],"exampleFix":"// before\nBulkSignatures bsim = new BulkSignatures(null);\nbsim.prewarm();\n\n// after\nBSimServerInfo info = new BSimServerInfo(...);\nBulkSignatures bsim = new BulkSignatures(info);\nbsim.prewarm();","handlingStrategy":"validation","validationCode":"// before any server command\nif (bsimServerInfo == null) {\n    throw new IllegalStateException(\n        \"BulkSignatures built without a server; cannot perform server operations\");\n}","typeGuard":"private static boolean canReachServer(BulkSignatures b) {\n    try {\n        b.getClass().getDeclaredMethod(\"checkBSimServerOperation\");\n        // best-effort: construct only with non-null BSimServerInfo for server work\n        return true;\n    } catch (NoSuchMethodException e) {\n        return true;\n    }\n}","tryCatchPattern":"try {\n    bsim.prewarm();\n} catch (UnsupportedOperationException e) {\n    if (e.getMessage().contains(\"BSim server has not been specified\")) {\n        // rebuild with a real BSimServerInfo and retry\n    } else { throw e; }\n}","preventionTips":["Construct BulkSignatures with a non-null BSimServerInfo whenever you will issue server commands.","Keep template/null-server handles limited to local generation only.","Resolve the BSim server URL from configuration at startup and fail early if absent."],"tags":["bsim","server-config","null-state","unsupportedoperationexception"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}