{"record":{"id":"16e582840b04a5fb","repo":"NationalSecurityAgency/ghidra","slug":"no-functions-matching-vectorid-vecresult-vectori","errorCode":null,"errorMessage":"No functions matching vectorid: {vecResult.vectorid}","messagePattern":"No functions matching vectorid: (.+?)","errorType":"exception","errorClass":"SQLException","httpStatus":null,"severity":"error","filePath":"Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/client/AbstractSQLFunctionDatabase.java","lineNumber":1855,"sourceCode":"\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\n\t/**\n\t * @param query the query to execute\n\t * @param filter the function filter \n\t * @param response the response object\n\t * @param descMgr the executable descriptor \n\t * @param iter the function iterator \n\t * @return the number of unique results found\n\t * @throws SQLException if there is an error issuing the query","sourceCodeStart":1837,"sourceCodeEnd":1873,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/client/AbstractSQLFunctionDatabase.java#L1837-L1873","documentation":"In the bulk query loop, a vector was returned by nearest-neighbor search but zero DescriptionRows reference it and no filter was applied (a filter would have triggered `continue`). The comment marks this as 'a sign of corruption in the database' -- an orphaned vector lacking function metadata. Bulk-path twin of error 750.","triggerScenarios":"A vector row exists but its descTable entries were deleted or never committed (aborted/partial ingest left an orphan). The bulk nearest-neighbor search surfaced the vector, but metadata resolution yields nothing.","commonSituations":"Aborted ingest leaving partial state; manual deletion of function rows without cleaning vectors; DB inconsistency after a crash; widespread orphans after a failed bulk load.","solutions":["Audit the DB for orphaned vectors (vector rows lacking a descTable entry).","Re-ingest the affected executables to restore consistency.","Run DB integrity checks and consider a rebuild if orphans are widespread."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Periodic integrity audit: flag vectors whose id has no descTable row.\nString sql = \"SELECT v.id FROM vectors v LEFT JOIN description d ON d.vector_id = v.id \" +\n    \"WHERE d.id IS NULL\";\ntry (Connection c = ds.getConnection();\n     Statement s = c.createStatement();\n     ResultSet rs = s.executeQuery(sql)) {\n    List<Long> orphans = new ArrayList<>();\n    while (rs.next()) orphans.add(rs.getLong(1));\n    if (!orphans.isEmpty()) log.warn(\"orphaned vectors: {}\", orphans);\n}","typeGuard":null,"tryCatchPattern":"try {\n    return db.queryNearestBulk(query);\n} catch (SQLException e) {\n    if (e.getMessage().startsWith(\"No functions matching vectorid:\")) {\n        // corruption in the bulk path -- trigger maintenance / re-ingest\n        triggerMaintenance();\n        throw new DatabaseCorruptException(e.getMessage(), e);\n    }\n    throw e;\n}","preventionTips":["Wrap bulk multi-row inserts in transactions so vectors and descriptions commit together.","Run periodic integrity audits for orphaned vectors, especially after bulk loads.","Verify consistency after crashes before serving bulk queries."],"tags":["database","corruption","query","vector","bsim"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}