{"record":{"id":"565212ed4eda061b","repo":"NationalSecurityAgency/ghidra","slug":"database-does-not-track-callgraph","errorCode":null,"errorMessage":"Database does not track callgraph","messagePattern":"Database does not track callgraph","errorType":"validation","errorClass":"LSHException","httpStatus":null,"severity":"error","filePath":"Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/client/AbstractSQLFunctionDatabase.java","lineNumber":1545,"sourceCode":"\t */\n\tprivate ExecutableRecord queryExecutableByMd5(String md5, DescriptionManager res)\n\t\t\tthrows LSHException, SQLException {\n\t\tExecutableRow row = exeTable.queryMd5ExeMatch(md5);\n\t\tif (row != null) {\n\t\t\treturn exeTable.makeExecutableRecord(res, row);\n\t\t}\n\t\treturn null;\n\t}\n\n\t/**\n\t * For every function currently in the manager, fill in its call graph information\n\t * @param manage the executable descriptor\n\t * @throws LSHException if the database does not track call graph information\n\t * @throws SQLException if there is a problem querying for function information\n\t */\n\tprivate void queryCallgraph(DescriptionManager manage) throws LSHException, SQLException {\n\t\tif (!info.trackcallgraph) {\n\t\t\tthrow new LSHException(\"Database does not track callgraph\");\n\t\t}\n\t\tTreeMap<RowKey, FunctionDescription> funcmap = new TreeMap<>();\n\t\tmanage.generateFunctionIdMap(funcmap);\n\t\tList<FunctionDescription> funclist = new ArrayList<>();\n\t\tfor (FunctionDescription element : funcmap.values()) { // Build a static copy of the list of functions\n\t\t\tfunclist.add(element);\n\t\t}\n\t\tfor (FunctionDescription element : funclist) {\n\t\t\tfillinChildren(element, manage, funcmap);\n\t\t}\n\t}\n\n\tprotected QueryResponseRecord doQuery(BSimQuery<?> query, Connection c)\n\t\t\tthrows LSHException, SQLException, DatabaseNonFatalException {\n\t\tif (query instanceof QueryNearest q) {\n\t\t\tfdbQueryNearest(q);\n\t\t}\n\t\telse if (query instanceof QueryNearestVector q) {","sourceCodeStart":1527,"sourceCodeEnd":1563,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/client/AbstractSQLFunctionDatabase.java#L1527-L1563","documentation":"`queryCallgraph` requires the DB to have call-graph tracking enabled (info.trackcallgraph). If false, LSHException is thrown. Call-graph tracking is an optional schema feature: the callgraphTable is only created at DB creation time when trackcallgraph is true, so a DB created without it simply lacks the supporting table.","triggerScenarios":"Calling an operation that needs call-graph data on a DB created without callgraph support. The schema does not contain the callgraph table, so the operation cannot proceed.","commonSituations":"DB created with default/legacy settings; querying children/callers against a DB provisioned for similarity-only; assuming a feature that was never enabled.","solutions":["Recreate the DB with call-graph tracking enabled.","Avoid callgraph-dependent queries against this DB.","Check the DB's info.trackcallgraph flag before issuing such queries and degrade gracefully."],"exampleFix":"// before: query against a callgraph-less DB\ndb.queryCallgraph(manager);          // throws\n// after: gate on the capability\nif (db.getInfo().trackcallgraph) {\n    db.queryCallgraph(manager);\n} else {\n    log.warn(\"DB does not track callgraph; skipping\");\n}","handlingStrategy":"validation","validationCode":"// Gate callgraph operations on the DB's declared capability.\nif (!db.getInfo().trackcallgraph) {\n    throw new UnsupportedOperationException(\n        \"This DB was created without callgraph tracking; recreate to enable\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    db.queryCallgraph(manager);\n} catch (LSHException e) {\n    if (e.getMessage().equals(\"Database does not track callgraph\")) {\n        // degrade gracefully; the schema lacks the callgraph table\n        log.warn(\"callgraph not available on this DB; skipping\");\n        return;\n    }\n    throw e;\n}","preventionTips":["Provision DBs with the features you intend to query (callgraph enabled at create time).","Capability-check info.trackcallgraph before issuing callgraph-dependent operations.","Document which DBs are callgraph-enabled in your deployment."],"tags":["config","capability","callgraph","bsim","schema"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}