NationalSecurityAgency/ghidra · error · ElasticException

No functions matching vectorid:

Error message

No functions matching vectorid: 

What it means

Thrown in queryNearest when a vector document was returned by the similarity search but queryVectorIdMatch returns an empty result set (descres.size() == 0) and no filter was applied. The code comment explicitly states this is a sign of database corruption: a vector exists in the repository_vector index but has no corresponding function documents in the executable index.

Source

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

		int count = 0;

		for (VectorResult dresult : resultset) {
			if (count >= query.max) {
				break;
			}
			final SignatureRecord srec = manager.newSignature(dresult.vec, dresult.hitcount);
			JsonArray descres;
			descres = queryVectorIdMatch(dresult.vectorid, filter, query.max - count);
			if (descres == null) {
				throw new ElasticException(
					"Error querying vectorid: " + Long.toString(dresult.vectorid));
			}
			if (descres.size() == 0) {
				if (filter != null) {
					continue; // Filter may have eliminated all results
				}
				// Otherwise this is a sign of corruption in the database
				throw new ElasticException(
					"No functions matching vectorid: " + Long.toString(dresult.vectorid));
			}
			count += descres.size();
			convertDescriptionRows(similarityResult, descres, dresult, manager, srec);
		}
	}

	/**
	 * Perform a full QueryNearest request, with additional filters, placing SimilarityResults
	 * in the ResponseNearest object. An iterator to FunctionDescriptions determines what
	 * subset of functions are actually being queried.
	 * @param query is overarching QueryNearest object
	 * @param filter is the (optional) additional filters results must pass
	 * @param response is the ResponseNearest accumulating results
	 * @param manager is an internal placeholder container primarily for caching ExecutableRecords 
	 * @param iter points to the subset of functions to query
	 * @return the total number of unique result sets produced by the query
	 * @throws ElasticException for communication problems with the server

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Re-ingest the affected executable(s) to restore function-to-vector consistency.
  2. Run a diagnostic query to find orphaned vectors: query repository_vector for ids whose id_signature has no matching function documents, then clean them up.
  3. If corruption is widespread, drop and recreate the database from source executables.
  4. Ensure no concurrent ingest or delete operations run during active similarity queries.
Defensive patterns

Strategy: try-catch

Try / catch

try {
    database.query(queryNearest);
} catch (ElasticException e) {
    if (e.getMessage().contains("No functions matching vectorid")) {
        // Orphaned vector — database integrity issue
        Msg.error(this, "Orphaned vector detected; re-ingest affected executables or rebuild database: " + e.getMessage());
    }
    throw e;
}

Prevention

When it happens

Trigger: During queryNearest, for each VectorResult dresult, queryVectorIdMatch issues a term query on id_signature for the vector id. If total==0 it returns an empty JsonArray. With filter==null, hitting an empty result means an orphaned vector document with zero function references.

Common situations: Interrupted or partial deletion of an executable that removed function documents but left vector documents behind; interrupted ingestion that wrote vector documents before function documents; concurrent delete operation removing functions while a query is in flight.

Related errors


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