NationalSecurityAgency/ghidra · error · SQLException

Id is not present in string table: {name}

Error message

Id is not present in string table: {name}

What it means

Thrown by SQLStringTable.getString when a string id resolves to no record — both the in-memory idMap cache and the database readStringRecord(id) return null. The stringtable maps integer ids to string values (names, paths, etc.); a missing id means a referential integrity break or an uninitialized cache.

Source

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

	/**
	 * Try to fetch string from our memory cache, or load it from database, or return empty string
	 * 
	 * @param id the row ID
	 * @return the string fetched from the table, or empty string if not found
	 * @throws SQLException if there is a problem parsing the table record(s)
	 */
	public String getString(long id) throws SQLException {
		if (id == 0) {
			return null;
		}
		StringRecord rec = idMap.get((int) id);
		if (rec != null) {
			moveToEnd(rec);
			return rec.value;
		}
		String res = readStringRecord(id);
		if (res == null) {
			throw new SQLException("Id is not present in string table: " + name);
		}
		return res;
	}

	public long writeString(String val) throws SQLException {
		if ((val == null) || (val.length() == 0)) {
			return 0;
		}
		StringRecord rec = stringMap.get(val);
		if (rec != null) {
			moveToEnd(rec);
			return rec.id;
		}
		// String is not in cache
		long id = readStringId(val);	// Try to read from database
		if (id != 0) {
			return id;
		}

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Run a referential-integrity check to find ids pointing to absent stringtable rows.
  2. Ensure the SQLStringTable is properly initialized/loaded from the database before lookups.
  3. If the database was rebuilt, re-resolve strings rather than reusing old ids.
  4. Restore from backup if stringtable rows are missing due to corruption.
Defensive patterns

Strategy: validation

Validate before calling

// Validate the string id is present before lookup.
if (id == 0) return null; // documented null sentinel
// Optionally prime the stringtable cache fully before lookups.
if (!stringTable.isLoaded()) stringTable.loadAll();

Try / catch

try {
    return stringTable.getString(id);
} catch (SQLException e) {
    if (e.getMessage().contains("not present in string table")) {
        log.warning("Missing string for id " + id + "; referential integrity break");
        return null; // or a placeholder
    }
    throw e;
}

Prevention

When it happens

Trigger: Calling getString(id) where id is non-zero but has no row in the stringtable and is not in the idMap cache. Occurs when an id stored elsewhere (e.g., in exetable or desctable) points to a stringtable row that does not exist, or when the SQLStringTable was not loaded/primed before querying.

Common situations: Referential integrity break: a foreign id referencing a deleted/nonexistent string. Database corruption or partial restore. Querying strings before the stringtable cache has been populated from the database. Cross-database id references. Version/schema mismatch where string ids were renumbered.

Related errors


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