{"record":{"id":"87834bd30db46a77","repo":"NationalSecurityAgency/ghidra","slug":"no-functions-matching-vectorid","errorCode":null,"errorMessage":"No functions matching 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":1380,"sourceCode":"\t\t\tthrows SQLException, LSHException {\n\t\tSignatureRecord srec = res.newSignature(dresult.vec, dresult.hitcount);\n\t\tList<DescriptionRow> descres;\n\t\tif (filter == null) {\n\t\t\tdescres = descTable.queryVectorIdMatch(dresult.vectorid, query.max - count);\n\t\t}\n\t\telse {\n\t\t\tdescres = descTable.queryVectorIdMatchFilter(dresult.vectorid, filter.tableClause(),\n\t\t\t\tfilter.whereClause(), query.max - count);\n\t\t}\n\t\tif (descres == null) {\n\t\t\tthrow new SQLException(\"Error querying vectorid: \" + Long.toString(dresult.vectorid));\n\t\t}\n\t\tif (descres.size() == 0) {\n\t\t\tif (filter != null) {\n\t\t\t\treturn 0; // Filter may have eliminated all results\n\t\t\t}\n\t\t\t// Otherwise this is a sign of corruption in the database\n\t\t\tthrow new SQLException(\n\t\t\t\t\"No functions matching vectorid: \" + Long.toString(dresult.vectorid));\n\t\t}\n\t\tconvertDescriptionRows(simres, descres, dresult, res, srec);\n\t\treturn descres.size();\n\t}\n\n\t/**\n\t * \n\t * @param resultset the list of result set objects to populate\n\t * @param vec the vector containing the saveSQL query statement\n\t * @param simthresh the similarity threshold\n\t * @param sigthresh the confidence threshold\n\t * @param max the max number of results to return\n\t * @return the number of results returned\n\t * @throws SQLException if there is a problem creating or executing the query\n\t */\n\tprotected abstract int queryNearestVector(List<VectorResult> resultset, LSHVector vec,\n\t\t\tdouble simthresh, double sigthresh, int max) throws SQLException;","sourceCodeStart":1362,"sourceCodeEnd":1398,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/client/AbstractSQLFunctionDatabase.java#L1362-L1398","documentation":"A vector exists in the vectors table (returned by nearest-neighbor search) but zero DescriptionRows reference it, and no filter was applied (a filter would have short-circuited with return 0). The code explicitly comments this as 'a sign of corruption in the database' -- an orphaned vector with no function metadata.","triggerScenarios":"A vector row exists but its descTable entries were deleted or never committed (aborted/partial insert left an orphan). The nearest-neighbor search found 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; transactional boundary violation during ingest.","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.queryNearest(query);\n} catch (SQLException e) {\n    if (e.getMessage().startsWith(\"No functions matching vectorid:\")) {\n        // corruption -- trigger maintenance / re-ingest rather than retry\n        triggerMaintenance();\n        throw new DatabaseCorruptException(e.getMessage(), e);\n    }\n    throw e;\n}","preventionTips":["Wrap multi-row inserts in transactions so vectors and descriptions commit together.","Run periodic integrity audits for orphaned vectors.","After a crash, verify consistency before serving 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"}