{"record":{"id":"b08bde62b107ca60","repo":"NationalSecurityAgency/ghidra","slug":"data-table-is-corrupt-missing-datatype-datatype","errorCode":null,"errorMessage":"Data table is corrupt. Missing datatype: {dataTypeID}","messagePattern":"Data table is corrupt\\. Missing datatype: (.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"critical","filePath":"Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/listing/DBTraceData.java","lineNumber":97,"sourceCode":"\tpublic DBTraceData(DBTraceCodeSpace space,\n\t\t\tDBTraceAddressSnapRangePropertyMapTree<DBTraceData, ?> tree,\n\t\t\tDBCachedObjectStore<?> store, DBRecord record) {\n\t\tsuper(space, tree, store, record);\n\t}\n\n\t@Override\n\tprotected void fresh(boolean created) throws IOException {\n\t\tsuper.fresh(created);\n\t\tif (created) {\n\t\t\treturn;\n\t\t}\n\t\tplatform = space.manager.platformManager.getPlatformByKey(platformKey);\n\t\tif (platform == null) {\n\t\t\tthrow new IOException(\"Data table is corrupt. Missing platform: \" + platformKey);\n\t\t}\n\t\tdataType = platform.getDataTypeManager().getDataType(dataTypeID);\n\t\tif (dataType == null) {\n\t\t\tthrow new IOException(\"Data table is corrupt. Missing datatype: \" + dataTypeID);\n\t\t}\n\t\tbaseDataType = getBaseDataType(dataType);\n\t\tfinal int dtLen = getDataTypeLength();\n\t\tif (dtLen != range.getLength() && dtLen != -1) {\n\t\t\tthrow new IOException(\n\t\t\t\t\"Data table is corrupt. Data unit and its datatype disagree on length.\");\n\t\t}\n\t\tdefaultSettings = dataType.getDefaultSettings();\n\t}\n\n\t@Override\n\tprotected void setRecordValue(DBTraceData value) {\n\t\t// Nothing. Entry is the value\n\t}\n\n\t@Override\n\tprotected DBTraceData getRecordValue() {\n\t\treturn this;","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/listing/DBTraceData.java#L79-L115","documentation":"Thrown by DBTraceData.fresh() when a data unit record references a dataTypeID that cannot be resolved by the platform's DataTypeManager. The data type was present when the unit was created but is now missing from the DTM — indicating either database corruption, an incomplete save, or a data type archive that is no longer available. The data unit cannot be reconstructed without its type definition.","triggerScenarios":"Loading a trace where a DBTraceData record's dataTypeID has no corresponding DataType in platform.getDataTypeManager(). Occurs during deserialization in fresh(false) when getDataType(dataTypeID) returns null.","commonSituations":"Custom data types defined in an external archive that is not loaded; trace file written while data type manager was mid-resolution; data type was deleted from the DTM but data units referencing it remain; version upgrade where a built-in type ID changed.","solutions":["Ensure all required data type archives are loaded/opened before opening the trace.","Restore the trace and its associated archives from a consistent backup set.","If the data type was deleted intentionally, the trace records referencing it are orphaned — this requires trace repair or recreation.","Verify Ghidra version compatibility between trace creation and opening."],"exampleFix":"// before — opens trace, data type missing\n// throws IOException: Missing datatype: 42\n\n// after — ensure the data type archive is loaded\nDataTypeManager dtm = platform.getDataTypeManager();\n// Load the archive containing the type before opening the trace:\ndtm.resolve(myStructType, DataTypeManager.DEFAULT_RESOLVER);\n// then open the trace","handlingStrategy":"try-catch","validationCode":"// Pre-load all required data type archives before opening the trace\nDataTypeManager dtm = platform.getDataTypeManager();\n// Ensure archives containing referenced types are loaded:\nFileDataTypeManager archive = FileDataTypeManager.open(archiveFile);\ndtm.associate(archive); // or resolve needed types","typeGuard":null,"tryCatchPattern":"try {\n    trace = dbTrace.openForReading(path);\n} catch (IOException e) {\n    if (e.getMessage().contains(\"Missing datatype\")) {\n        Msg.error(MyClass.class, \"Trace references missing data type: \" + e.getMessage());\n        // Load the appropriate archive and retry\n    } else {\n        throw e;\n    }\n}","preventionTips":["Load all data type archives referenced by the trace before opening it.","Keep trace files and their data type archives together in a consistent set.","Use the same Ghidra version and installed type archives when creating and opening traces.","Back up data type archives alongside traces."],"tags":["data-corruption","database","data-type","trace-modeling"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}