{"record":{"id":"9cdc79b7b58058a5","repo":"NationalSecurityAgency/ghidra","slug":"id-is-not-present-in-string-table-name","errorCode":null,"errorMessage":"Id is not present in string table: {name}","messagePattern":"Id is not present in string table: (.+?)","errorType":"exception","errorClass":"SQLException","httpStatus":null,"severity":"error","filePath":"Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/client/tables/SQLStringTable.java","lineNumber":112,"sourceCode":"\t/**\n\t * Try to fetch string from our memory cache, or load it from database, or return empty string\n\t * \n\t * @param id the row ID\n\t * @return the string fetched from the table, or empty string if not found\n\t * @throws SQLException if there is a problem parsing the table record(s)\n\t */\n\tpublic String getString(long id) throws SQLException {\n\t\tif (id == 0) {\n\t\t\treturn null;\n\t\t}\n\t\tStringRecord rec = idMap.get((int) id);\n\t\tif (rec != null) {\n\t\t\tmoveToEnd(rec);\n\t\t\treturn rec.value;\n\t\t}\n\t\tString res = readStringRecord(id);\n\t\tif (res == null) {\n\t\t\tthrow new SQLException(\"Id is not present in string table: \" + name);\n\t\t}\n\t\treturn res;\n\t}\n\n\tpublic long writeString(String val) throws SQLException {\n\t\tif ((val == null) || (val.length() == 0)) {\n\t\t\treturn 0;\n\t\t}\n\t\tStringRecord rec = stringMap.get(val);\n\t\tif (rec != null) {\n\t\t\tmoveToEnd(rec);\n\t\t\treturn rec.id;\n\t\t}\n\t\t// String is not in cache\n\t\tlong id = readStringId(val);\t// Try to read from database\n\t\tif (id != 0) {\n\t\t\treturn id;\n\t\t}","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/client/tables/SQLStringTable.java#L94-L130","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Run a referential-integrity check to find ids pointing to absent stringtable rows.","Ensure the SQLStringTable is properly initialized/loaded from the database before lookups.","If the database was rebuilt, re-resolve strings rather than reusing old ids.","Restore from backup if stringtable rows are missing due to corruption."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Validate the string id is present before lookup.\nif (id == 0) return null; // documented null sentinel\n// Optionally prime the stringtable cache fully before lookups.\nif (!stringTable.isLoaded()) stringTable.loadAll();","typeGuard":null,"tryCatchPattern":"try {\n    return stringTable.getString(id);\n} catch (SQLException e) {\n    if (e.getMessage().contains(\"not present in string table\")) {\n        log.warning(\"Missing string for id \" + id + \"; referential integrity break\");\n        return null; // or a placeholder\n    }\n    throw e;\n}","preventionTips":["Run referential-integrity checks after migrations or restores.","Load/prime the stringtable cache before bulk lookups.","Do not reuse string ids across different databases."],"tags":["bsim","database","string-table","referential-integrity","missing-row","sql-exception"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}