NationalSecurityAgency/ghidra · error · LSHException

Could not rebuild index: {}

Error message

Could not rebuild index: {}

What it means

Thrown in rebuildIndex when ResponseAdjustIndex response is null after issuing AdjustVectorIndex with doRebuild=true. The server could not perform the rebuild and BulkSignatures wraps its BSimError message as 'Could not rebuild index: <message>' (LSHException). A non-null response that indicates the operation is unsupported is logged, not thrown.

Source

Thrown at Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/ingest/BulkSignatures.java:629

			Msg.info(this, "Successfully dropped index " + dbDetail);
		}
	}

	/**
	 * Rebuilds the current BSim database index.
	 * 
	 * @throws IOException if there's an error establishing the database connection
	 * @throws LSHException if there's an error issuing the query
	 */
	public void rebuildIndex() throws IOException, LSHException {
		DatabaseInformation info = establishQueryServerConnection(false);
		AdjustVectorIndex query = new AdjustVectorIndex();
		query.doRebuild = true;
		System.out.println("Starting rebuild ...");
		ResponseAdjustIndex response = query.execute(querydb);
		if (response == null) {
			BSimError lastError = querydb.getLastError();
			throw new LSHException("Could not rebuild index: " + lastError.message);
		}
		String dbDetail = "for database " + info.databasename + " (" + bsimServerInfo + ")";
		if (!response.success) {
			String msg = "Could not rebuild index " + dbDetail;
			if (!response.operationSupported) {
				msg += ": operation not supported";
			}
			Msg.error(this, msg);
		}
		else {
			Msg.info(this, "Successfully rebuilt index " + dbDetail);
		}
	}

	/**
	 * Performs a prewarm command on the BSim database.
	 * 
	 * @throws IOException if there's an error establishing the database connection

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Ingest signatures first so the index has data to build over, then rebuild.
  2. Check the message and server logs for resource/permission causes.
  3. Free backend resources (RAM/disk) and retry.
  4. Confirm the backend supports rebuild operations.

Example fix

// before
bsim.rebuildIndex();  // empty DB -> LSHException

// after
// ingest first, then rebuild
bsim.sendSignaturesToServer(dir, null, monitor);
bsim.rebuildIndex();
Defensive patterns

Strategy: try-catch

Validate before calling

// ingest signatures before rebuilding so the index has data
bsim.sendSignaturesToServer(dir, null, monitor);

Try / catch

try {
    bsim.rebuildIndex();
} catch (LSHException e) {
    // message: "Could not rebuild index: <server>"; ensure data + resources, then retry
}

Prevention

When it happens

Trigger: Rebuilding the index on a near-empty database, a backend lacking rebuild support, a connection failure during the (potentially long) rebuild, or insufficient resources.

Common situations: Calling rebuildIndex before any signatures are ingested; backend resource exhaustion (memory/disk) during rebuild; unsupported backend; privileges.

Related errors


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