{"record":{"id":"9245db7413bd74bd","repo":"NationalSecurityAgency/ghidra","slug":"error-querying-vectorid-vecresult-vectorid","errorCode":null,"errorMessage":"Error querying vectorid: {vecResult.vectorid}","messagePattern":"Error querying vectorid: (.+?)","errorType":"exception","errorClass":"SQLException","httpStatus":null,"severity":"error","filePath":"Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/client/AbstractSQLFunctionDatabase.java","lineNumber":1847,"sourceCode":"\t\t\tvectorList.add(vecResult);\n\t\t}\n\t\tint count = 0;\n\t\tDescriptionManager manage = 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 = manage.newSignature(vecResult.vec, vecResult.hitcount);\n\t\t\tList<DescriptionRow> descres;\n\t\t\tif (filter == null) {\n\t\t\t\tdescres = descTable.queryVectorIdMatch(vecResult.vectorid, query.max - count);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tdescres = descTable.queryVectorIdMatchFilter(vecResult.vectorid,\n\t\t\t\t\tfilter.tableClause(), filter.whereClause(), query.max - count);\n\t\t\t}\n\t\t\tif (descres == null) {\n\t\t\t\tthrow new SQLException(\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 SQLException(\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, manage, srec);\n\t\t}\n\t\tif (query.fillinCategories && (info.execats != null)) {\n\t\t\tfillinExecutableCategories(manage);\n\t\t}\n\t}\n","sourceCodeStart":1829,"sourceCodeEnd":1865,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/client/AbstractSQLFunctionDatabase.java#L1829-L1865","documentation":"In the bulk/multi-result query loop (line ~1847), after each vector result the code queries `descTable` for matching function rows. `queryVectorIdMatch` returning null signals an internal query error (not an empty result, which is handled separately and `continue`s on filter). A null return causes SQLException with the vectorid. This is the bulk-path twin of error 749.","triggerScenarios":"An internal failure during result resolution in the bulk loop -- connection drop mid-iteration, transient DB error, or a null inside the query method while processing many vector results.","commonSituations":"Transient connection issues on large multi-result queries; DB under heavy load; driver timeout during a long scan; partial failure partway through a batch.","solutions":["Retry the query -- this is typically transient.","Check DB connectivity, pool health, and query latency.","If persistent, investigate the vectorid and descTable consistency."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Bulk-path internal query error -- transient; retry the whole query with backoff.\nSQLException last = null;\nfor (int attempt = 0; attempt < 3; attempt++) {\n    try { return db.queryNearestBulk(query); }\n    catch (SQLException e) {\n        if (!e.getMessage().startsWith(\"Error querying vectorid:\")) throw e;\n        last = e;\n        Thread.sleep(150L * (1L << attempt));\n    }\n}\nthrow last;","preventionTips":["Keep the DB connection healthy; size the pool for bulk queries.","Monitor latency on multi-result scans.","Retry transient internal-query errors with backoff; escalate if persistent."],"tags":["database","query","vector","transient","bsim"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}