{"record":{"id":"e4446baf4276645d","repo":"NationalSecurityAgency/ghidra","slug":"error-querying-vectorid-vectorid","errorCode":null,"errorMessage":"Error querying vectorid: ${vectorid}","messagePattern":"Error querying vectorid: (.+?)","errorType":"exception","errorClass":"ElasticException","httpStatus":null,"severity":"error","filePath":"Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/elastic/ElasticDatabase.java","lineNumber":3308,"sourceCode":"\t\twhile (iter1.hasNext()) {\n\t\t\tfetchVectors(iter1, iter2, 50);\t\t\t\t\t\t// Fetch vector associated with each vectorid\n\t\t}\n\t\titer1 = vectorList.iterator();\n\t\titer2 = vectorList.iterator();\n\t\twhile (iter1.hasNext()) {\n\t\t\tfetchVectorCounts(iter1, iter2, MAX_VECTORCOUNT_WINDOW);\t// Fetch hitcount of each vector\n\t\t}\n\t\tint count = 0;\n\t\tDescriptionManager manager = query.matchresponse.manage;\n\t\tfor (VectorResult vecResult : vectorList) {\n\t\t\tif (count >= query.max) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tSignatureRecord srec = manager.newSignature(vecResult.vec, vecResult.hitcount);\n\t\t\tJsonArray descres;\n\t\t\tdescres = queryVectorIdMatch(vecResult.vectorid, filter, query.max - count);\n\t\t\tif (descres == null) {\n\t\t\t\tthrow new ElasticException(\n\t\t\t\t\t\"Error querying vectorid: \" + Long.toString(vecResult.vectorid));\n\t\t\t}\n\t\t\tif (descres.size() == 0) {\n\t\t\t\tif (filter != null) {\n\t\t\t\t\tcontinue; // Filter may have eliminated all results\n\t\t\t\t}\n\t\t\t\t// Otherwise this is a sign of corruption in the database\n\t\t\t\tthrow new ElasticException(\n\t\t\t\t\t\"No functions matching vectorid: \" + Long.toString(vecResult.vectorid));\n\t\t\t}\n\t\t\tcount += descres.size();\n\t\t\tconvertDescriptionRows(null, descres, vecResult, manager, srec);\n\t\t}\n\t}\n\n\t/**\n\t * Entry point for the Elasticsearch version of QueryDelete command:\n\t *   Delete specific executables from the database","sourceCodeStart":3290,"sourceCodeEnd":3326,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/elastic/ElasticDatabase.java#L3290-L3326","documentation":"In the similarity-query path, queryVectorIdMatch for a vector returns null (not an empty array), interpreted as a query-level error rather than 'no matches'. It throws ElasticException(\"Error querying vectorid: <id>\").","triggerScenarios":"A similarity query where fetching function descriptions for a specific vector id fails to yield a usable response (server error, malformed/empty response envelope).","commonSituations":"Transient ES errors; partial cluster outage; response-shape change after a server upgrade; overloaded cluster timing out one shard.","solutions":["Retry the query once (often transient).","Check ES cluster health and logs for the failing shard/request.","Re-ingest the affected executable if a specific vector is permanently broken."],"exampleFix":"// before\nResponse resp = db.query(req); // surfaces opaque 'Error querying vectorid'\n// after\nResponse resp = retryOn(() -> db.query(req), 3, ElasticException.class);","handlingStrategy":"retry","validationCode":"// Skip the query if the cluster is unhealthy.\nif (!clusterHealthy()) throw new ServiceUnavailableException(\"Cluster unhealthy\");","typeGuard":null,"tryCatchPattern":"// Retry transient query failures a bounded number of times.\nfor (int i = 0; i < 3; i++) {\n    try { return db.query(req); }\n    catch (ElasticException e) {\n        if (i == 2 || !isTransient(e.getMessage())) throw e;\n    }\n}","preventionTips":["Keep the ES cluster healthy and resourced for similarity queries.","Retry with backoff on transient query errors."],"tags":["bsim","elasticsearch","query"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}