NationalSecurityAgency/ghidra · error · SQLException

Error querying vectorid:

Error message

Error querying vectorid: 

What it means

In the single-result query path, after a nearest-neighbor vector is found, the code queries `descTable` for matching function rows. `queryVectorIdMatch` returns null on an internal query error (distinct from an empty result, which is handled separately). A null return means the underlying query itself failed, so SQLException is thrown carrying the vectorid.

Source

Thrown at Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/client/AbstractSQLFunctionDatabase.java:1373

	 * @param simres receives the list of results and their similarity to the base vector
	 * @return number of 
	 * @throws SQLException if there is an error issuing the query
	 * @throws LSHException if executable record creation fails
	 */
	protected int retrieveFuncDescFromVectors(VectorResult dresult, DescriptionManager res,
			int count, QueryNearest query, BSimSqlClause filter, SimilarityResult simres)
			throws SQLException, LSHException {
		SignatureRecord srec = res.newSignature(dresult.vec, dresult.hitcount);
		List<DescriptionRow> descres;
		if (filter == null) {
			descres = descTable.queryVectorIdMatch(dresult.vectorid, query.max - count);
		}
		else {
			descres = descTable.queryVectorIdMatchFilter(dresult.vectorid, filter.tableClause(),
				filter.whereClause(), query.max - count);
		}
		if (descres == null) {
			throw new SQLException("Error querying vectorid: " + Long.toString(dresult.vectorid));
		}
		if (descres.size() == 0) {
			if (filter != null) {
				return 0; // Filter may have eliminated all results
			}
			// Otherwise this is a sign of corruption in the database
			throw new SQLException(
				"No functions matching vectorid: " + Long.toString(dresult.vectorid));
		}
		convertDescriptionRows(simres, descres, dresult, res, srec);
		return descres.size();
	}

	/**
	 * 
	 * @param resultset the list of result set objects to populate
	 * @param vec the vector containing the saveSQL query statement
	 * @param simthresh the similarity threshold

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Retry the query -- this is typically transient.
  2. Check DB connectivity, pool health, and query latency.
  3. If persistent, investigate the vectorid and descTable consistency.
Defensive patterns

Strategy: retry

Try / catch

// Internal query error -- transient; retry with bounded backoff.
SQLException last = null;
for (int attempt = 0; attempt < 3; attempt++) {
    try { return db.queryNearest(query); }
    catch (SQLException e) {
        if (!e.getMessage().startsWith("Error querying vectorid:")) throw e;
        last = e;
        Thread.sleep(100L * (1L << attempt));
    }
}
throw last;

Prevention

When it happens

Trigger: An internal failure during result resolution -- connection drop mid-query, transient DB error, or a null inside the query method. This is the single-result variant (line ~1373), separate from the bulk loop at 1847.

Common situations: Transient connection issues; DB under heavy load; partial state from a long-running query; driver timeout.

Related errors


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