NationalSecurityAgency/ghidra · error · LSHException

Database does not track callgraph

Error message

Database does not track callgraph

What it means

`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.

Source

Thrown at Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/client/AbstractSQLFunctionDatabase.java:1545

	 */
	private ExecutableRecord queryExecutableByMd5(String md5, DescriptionManager res)
			throws LSHException, SQLException {
		ExecutableRow row = exeTable.queryMd5ExeMatch(md5);
		if (row != null) {
			return exeTable.makeExecutableRecord(res, row);
		}
		return null;
	}

	/**
	 * For every function currently in the manager, fill in its call graph information
	 * @param manage the executable descriptor
	 * @throws LSHException if the database does not track call graph information
	 * @throws SQLException if there is a problem querying for function information
	 */
	private void queryCallgraph(DescriptionManager manage) throws LSHException, SQLException {
		if (!info.trackcallgraph) {
			throw new LSHException("Database does not track callgraph");
		}
		TreeMap<RowKey, FunctionDescription> funcmap = new TreeMap<>();
		manage.generateFunctionIdMap(funcmap);
		List<FunctionDescription> funclist = new ArrayList<>();
		for (FunctionDescription element : funcmap.values()) { // Build a static copy of the list of functions
			funclist.add(element);
		}
		for (FunctionDescription element : funclist) {
			fillinChildren(element, manage, funcmap);
		}
	}

	protected QueryResponseRecord doQuery(BSimQuery<?> query, Connection c)
			throws LSHException, SQLException, DatabaseNonFatalException {
		if (query instanceof QueryNearest q) {
			fdbQueryNearest(q);
		}
		else if (query instanceof QueryNearestVector q) {

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Recreate the DB with call-graph tracking enabled.
  2. Avoid callgraph-dependent queries against this DB.
  3. Check the DB's info.trackcallgraph flag before issuing such queries and degrade gracefully.

Example fix

// before: query against a callgraph-less DB
db.queryCallgraph(manager);          // throws
// after: gate on the capability
if (db.getInfo().trackcallgraph) {
    db.queryCallgraph(manager);
} else {
    log.warn("DB does not track callgraph; skipping");
}
Defensive patterns

Strategy: validation

Validate before calling

// Gate callgraph operations on the DB's declared capability.
if (!db.getInfo().trackcallgraph) {
    throw new UnsupportedOperationException(
        "This DB was created without callgraph tracking; recreate to enable");
}

Try / catch

try {
    db.queryCallgraph(manager);
} catch (LSHException e) {
    if (e.getMessage().equals("Database does not track callgraph")) {
        // degrade gracefully; the schema lacks the callgraph table
        log.warn("callgraph not available on this DB; skipping");
        return;
    }
    throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: DB created with default/legacy settings; querying children/callers against a DB provisioned for similarity-only; assuming a feature that was never enabled.

Related errors


AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14). Data as JSON: /api/errors/565212ed4eda061b. Report an issue: GitHub.