{"record":{"id":"b9b0d837157d86aa","repo":"NationalSecurityAgency/ghidra","slug":"could-not-drop-index","errorCode":null,"errorMessage":"Could not drop index: {}","messagePattern":"Could not drop index: (.+?)","errorType":"exception","errorClass":"LSHException","httpStatus":null,"severity":"error","filePath":"Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/ingest/BulkSignatures.java","lineNumber":600,"sourceCode":"\t\t}\n\t}\n\n\t/**\n\t * Drops the current BSim database index which can allow for faster signature ingest after\n\t * which a {@link #rebuildIndex()} may be performed.  Dropping the index may also be done to\n\t * obtain more accurate results albeit at the cost of performance.\n\t * \n\t * @throws IOException if there's an error establishing the database connection\n\t * @throws LSHException if there's an error issuing the query\n\t */\n\tpublic void dropIndex() throws IOException, LSHException {\n\t\tDatabaseInformation info = establishQueryServerConnection(false);\n\t\tAdjustVectorIndex query = new AdjustVectorIndex();\n\t\tquery.doRebuild = false;\n\t\tResponseAdjustIndex response = query.execute(querydb);\n\t\tif (response == null) {\n\t\t\tBSimError lastError = querydb.getLastError();\n\t\t\tthrow new LSHException(\"Could not drop index: \" + lastError.message);\n\t\t}\n\t\tString dbDetail = \"for database \" + info.databasename + \" (\" + bsimServerInfo + \")\";\n\t\tif (!response.success) {\n\t\t\tString msg = \"Could not drop the index \" + dbDetail;\n\t\t\tif (!response.operationSupported) {\n\t\t\t\tmsg += \": operation not supported\";\n\t\t\t}\n\t\t\tMsg.error(this, msg);\n\t\t}\n\t\telse {\n\t\t\tMsg.info(this, \"Successfully dropped index \" + dbDetail);\n\t\t}\n\t}\n\n\t/**\n\t * Rebuilds the current BSim database index.\n\t * \n\t * @throws IOException if there's an error establishing the database connection","sourceCodeStart":582,"sourceCodeEnd":618,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/ingest/BulkSignatures.java#L582-L618","documentation":"Thrown in dropIndex when ResponseAdjustIndex response is null, i.e. the server rejected the AdjustVectorIndex (doRebuild=false) command. BulkSignatures surfaces the server's BSimError message as an LSHException 'Could not drop index: <message>'. A non-null but unsuccessful response (e.g. operation not supported) is handled as a logged error, not thrown.","triggerScenarios":"Calling dropIndex on a database with no index to drop, a backend that does not support index operations, or during a connection/protocol failure that yields a null response.","commonSituations":"Dropping an index that was never built; backend (e.g. certain H2 configs) lacks vector-index support; transient server error; insufficient privileges.","solutions":["Read the message to learn the server's reason.","Confirm an index exists before dropping (rebuildIndex/dropIndex only make sense after population).","Retry on transient failures; report persistent unsupported/protocol errors.","Ensure privileges allow index operations."],"exampleFix":"// before\nbsim.dropIndex();  // no index / unsupported -> LSHException\n\n// after\n// only drop after the DB is populated and an index exists; otherwise skip","handlingStrategy":"try-catch","validationCode":"// only drop when an index is known to exist on a populated, supported DB","typeGuard":null,"tryCatchPattern":"try {\n    bsim.dropIndex();\n} catch (LSHException e) {\n    // message: \"Could not drop index: <server>\"; if unsupported or none exists, log and continue\n}","preventionTips":["Only call dropIndex on a populated database that has an index.","Confirm the backend supports vector-index operations.","Treat unsupported as informational once verified."],"tags":["bsim","index","drop-index","lshexception"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}