NationalSecurityAgency/ghidra · error · ElasticException

Error during vector deletion

Error message

Error during vector deletion

What it means

Thrown in deleteRawVectors when the bulk delete response has "errors": true, meaning one or more individual delete operations within the _bulk request failed. Unlike the decrement path, this method does not inspect individual item errors — it fails fast on the top-level errors flag.

Source

Thrown at Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/elastic/ElasticDatabase.java:1862

	 * @throws ElasticException for communication problems with the server
	 */
	private void deleteRawVectors(Iterator<IdHistogram> iter, int maxVectors)
			throws ElasticException {
		StringBuilder buffer = new StringBuilder();
		do {
			IdHistogram entry = iter.next();
			buffer.append("{ \"delete\": { \"_index\": \"")
					.append(repository)
					.append("_vector\", ");
			buffer.append("\"_id\": \"");
			Base64Lite.encodeLongBase64(buffer, entry.id);
			buffer.append("\" } }\n");
			maxVectors -= 1;
		}
		while (iter.hasNext() && maxVectors > 0);
		JsonObject resp = connection.executeBulk("/_bulk", buffer.toString());
		if (resp.get("errors").getAsBoolean()) {
			throw new ElasticException("Error during vector deletion");
		}
	}

	/**
	 * Delete function documents and exe document associated with an executable id
	 * @param exeId is the executable's document id
	 * @return the number of function documents deleted
	 * @throws ElasticException for communication problems with the server
	 */
	private int deleteExeDocuments(String exeId) throws ElasticException {
		StringBuilder buffer = new StringBuilder();
		buffer.append("{ \"query\": {");
		buffer.append("  \"parent_id\": {");
		buffer.append("    \"type\": \"function\",");
		buffer.append("    \"id\": \"").append(exeId).append("\" } } }");
		JsonObject resp = connection.executeStatement(ElasticConnection.POST,
			"executable/_delete_by_query", buffer.toString());
		long numDocs = resp.get("deleted").getAsLong();

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Inspect the individual item errors in the bulk response to identify which vector ids failed and why — modify the code or query _bulk manually to see per-item error details.
  2. Clear any read-only blocks: PUT repository_vector/_settings {"index.blocks.read_only": null}.
  3. Free disk space if Elasticsearch triggered the flood-stage read-only watermark.
  4. Retry the deletion after shard recovery completes; ensure no concurrent delete targets the same vectors.
Defensive patterns

Strategy: retry

Try / catch

try {
    database.query(deleteQuery);
} catch (ElasticException e) {
    if (e.getMessage().equals("Error during vector deletion")) {
        // Inspect per-item errors; may be transient (already deleted) or persistent (read-only)
        Msg.warn(this, "Vector deletion had errors — checking if vectors already removed: " + e.getMessage());
        // Retry or verify remaining vectors
    }
    throw e;
}

Prevention

When it happens

Trigger: Called during executable deletion to remove vector documents whose meta reference counts reached zero. The repository_vector/_bulk delete request completes but Elasticsearch sets errors=true because at least one sub-operation (delete by _id) encountered a problem.

Common situations: Vector documents were already deleted by a concurrent operation (version not found); shard unavailable or recovering; read-only index block (index.blocks.read_only); disk pressure triggering flood-stage watermark; permissions issue on specific documents.

Related errors


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