NationalSecurityAgency/ghidra · critical · ElasticException

vector document does not exist for id=

Error message

vector document does not exist for id=

What it means

In fetchVectors, after the vector document's _id matches, its _source is checked for null. A null/JsonNull _source means ES returned a doc envelope for the id but the vector document body is absent: the vector was deleted or never indexed while a result still references it. Index-consistency break; the features field cannot be read.

Source

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

		buffer.append(" ] }");
		JsonObject resp =
			connection.executeStatement(ElasticConnection.GET, "vector/_mget", buffer.toString());
		JsonArray docs = (JsonArray) resp.get("docs");
		char[] vectorDecodeBuffer = Base64VectorFactory.allocateBuffer();
		for (int i = 0; i < maxDocuments; ++i) {
			if (!iter2.hasNext()) {
				break;
			}
			vecRes = iter2.next();
			JsonObject oneResp = (JsonObject) docs.get(i);
			String matchId = oneResp.get("_id").getAsString();
			long matchIdVal = Base64Lite.decodeLongBase64(matchId);
			if (matchIdVal != vecRes.vectorid) {
				throw new ElasticException("Mismatch in vectorid");
			}
			JsonElement source = oneResp.get("_source");
			if (ElasticConnection.isNull(source)) {
				throw new ElasticException("vector document does not exist for id=" + matchId);
			}
			StringReader reader =
				new StringReader(((JsonObject) source).get("features").getAsString());
			try {
				vecRes.vec = vectorFactory.restoreVectorFromBase64(reader, vectorDecodeBuffer);
			}
			catch (IOException e) {
				throw new ElasticException(e.getMessage());
			}
		}
	}

	/**
	 * Given a list of FunctionDescriptions, fill in the matching SignatureRecords
	 * @param listFunctions is the list of functions
	 * @param manager is the FunctionDescription container
	 * @throws ElasticException for communication problems with the server
	 */

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Retry after a short delay to allow refresh/replication to converge.
  2. If persistent, locate the missing vector document and re-ingest it, or rebuild the vector index.
  3. Verify cluster health (yellow/red, unassigned shards) which typically accompanies such gaps.

Example fix

// before
db.fetchVectors(it1, it2, n);
// after
try { db.fetchVectors(it1, it2, n); }
catch (ElasticException e) {
  if (e.getMessage().startsWith("vector document does not exist")) { sleep(2000); db.fetchVectors(it1copy, it2copy, n); return; }
  throw e;
}
Defensive patterns

Strategy: retry

Validate before calling

public static boolean vectorPresent(ElasticConnection c, String b64Id) throws ElasticException {
    JsonObject r = c.executeStatementExpectFailure(ElasticConnection.GET, "vector/_doc/" + b64Id, "");
    JsonElement found = ((JsonObject) r).get("found");
    return found != null && found.getAsString().equals("true");
}

Try / catch

try {
    db.fetchVectors(it1, it2, n);
} catch (ElasticException e) {
    if (!e.getMessage().startsWith("vector document does not exist")) throw e;
    Thread.sleep(2000);
    db.fetchVectors(copy(it1), copy(it2), n);
}

Prevention

When it happens

Trigger: A VectorResult references a vectorid, vector/_mget returns a doc with that _id but _source is null. Happens after partial delete of vector docs, interrupted ingest, replication lag, or corruption.

Common situations: Interrupted ingest that recorded meta but not all vectors; a delete leaving dangling references; replica inconsistency during node failure.

Related errors


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