NationalSecurityAgency/ghidra · error · SQLException

SQL database does not have callgraph information enabled

Error message

SQL database does not have callgraph information enabled

What it means

Thrown by CallgraphTable.queryCallgraphRows when the boolean trackcallgraph parameter is false, meaning the BSim SQL database was created/configured without call-graph tracking enabled. The call-graph table stores function-to-function call edges; if the database does not populate them, querying callgraph rows is meaningless and is rejected upfront.

Source

Thrown at Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/client/tables/CallgraphTable.java:84

	 */
	public static CallgraphRow extractCallgraphRow(ResultSet pgres) throws SQLException {
		CallgraphRow res = new CallgraphRow();
		res.src = pgres.getLong(1);
		res.dest = pgres.getLong(2);
		return res;
	}

	/**
	 * 
	 * @param func the function description
	 * @param trackcallgraph true if the database tracks call graph information
	 * @return the list of {@link CallgraphRow}s
	 * @throws SQLException if there is a problem parsing the {@link ResultSet} objects
	 */
	public List<CallgraphRow> queryCallgraphRows(FunctionDescription func,
		boolean trackcallgraph) throws SQLException {
		if (!trackcallgraph) {
			throw new SQLException("SQL database does not have callgraph information enabled");
		}
		PreparedStatement s =
			selectStatement.prepareIfNeeded(() -> db.prepareStatement(SELECT_STMT));
		RowKey funcid = func.getId();
		if (funcid == null) {
			throw new SQLException("FunctionDescription does not have id");
		}
		s.setLong(1, funcid.getLong());
		try (ResultSet rs = s.executeQuery()) {
			List<CallgraphRow> callvec = new ArrayList<>();
			while (rs.next()) {
				CallgraphRow row = extractCallgraphRow(rs);
				if (row.dest == 0) {
					continue;
				}
				callvec.add(row);
			}
			return callvec;

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Recreate or choose a BSim database that was created with call-graph tracking enabled.
  2. Before calling callgraph-dependent APIs, check the database capabilities/layout and skip or warn if callgraph is unsupported.
  3. Pass trackcallgraph=true only when the database actually supports it; gate the call behind a capability check.
  4. Consult the BSim database creation options to enable the callgraph table at build time.

Example fix

// before
List<CallgraphRow> rows = callgraphTable.queryCallgraphRows(func, dbTracksCallgraph);

// after
if (!dbTracksCallgraph) {
    log.warning("Callgraph not enabled on this database; skipping callgraph query.");
    return Collections.emptyList();
}
List<CallgraphRow> rows = callgraphTable.queryCallgraphRows(func, true);
Defensive patterns

Strategy: validation

Validate before calling

// Check the database capability before invoking callgraph queries.
if (!bsimDatabase.tracksCallgraph()) {
    log.warning("Callgraph not enabled; skipping callgraph query.");
    return Collections.emptyList();
}
return callgraphTable.queryCallgraphRows(func, true);

Prevention

When it happens

Trigger: Calling queryCallgraphRows(func, false) — i.e., the caller passed trackcallgraph=false. This typically happens when the database's capabilities flag indicates no callgraph support, and the higher-level code forwards that flag down. The database was built with callgraph tracking disabled (a BSim database creation/layout option).

Common situations: Creating a BSim database without the callgraph layout option enabled, then attempting a query or analysis mode that requires call-graph edges (e.g., function reachability, callgraph-based clustering). Version or layout mismatch between the database generator and the analysis tool. Assuming all BSim databases track call graphs when some layouts omit them.

Related errors


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