NationalSecurityAgency/ghidra · critical · IOException

Data table is corrupt. Missing datatype: {dataTypeID}

Error message

Data table is corrupt. Missing datatype: {dataTypeID}

What it means

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.

Source

Thrown at Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/listing/DBTraceData.java:97

	public DBTraceData(DBTraceCodeSpace space,
			DBTraceAddressSnapRangePropertyMapTree<DBTraceData, ?> tree,
			DBCachedObjectStore<?> store, DBRecord record) {
		super(space, tree, store, record);
	}

	@Override
	protected void fresh(boolean created) throws IOException {
		super.fresh(created);
		if (created) {
			return;
		}
		platform = space.manager.platformManager.getPlatformByKey(platformKey);
		if (platform == null) {
			throw new IOException("Data table is corrupt. Missing platform: " + platformKey);
		}
		dataType = platform.getDataTypeManager().getDataType(dataTypeID);
		if (dataType == null) {
			throw new IOException("Data table is corrupt. Missing datatype: " + dataTypeID);
		}
		baseDataType = getBaseDataType(dataType);
		final int dtLen = getDataTypeLength();
		if (dtLen != range.getLength() && dtLen != -1) {
			throw new IOException(
				"Data table is corrupt. Data unit and its datatype disagree on length.");
		}
		defaultSettings = dataType.getDefaultSettings();
	}

	@Override
	protected void setRecordValue(DBTraceData value) {
		// Nothing. Entry is the value
	}

	@Override
	protected DBTraceData getRecordValue() {
		return this;

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Ensure all required data type archives are loaded/opened before opening the trace.
  2. Restore the trace and its associated archives from a consistent backup set.
  3. If the data type was deleted intentionally, the trace records referencing it are orphaned — this requires trace repair or recreation.
  4. Verify Ghidra version compatibility between trace creation and opening.

Example fix

// before — opens trace, data type missing
// throws IOException: Missing datatype: 42

// after — ensure the data type archive is loaded
DataTypeManager dtm = platform.getDataTypeManager();
// Load the archive containing the type before opening the trace:
dtm.resolve(myStructType, DataTypeManager.DEFAULT_RESOLVER);
// then open the trace
Defensive patterns

Strategy: try-catch

Validate before calling

// Pre-load all required data type archives before opening the trace
DataTypeManager dtm = platform.getDataTypeManager();
// Ensure archives containing referenced types are loaded:
FileDataTypeManager archive = FileDataTypeManager.open(archiveFile);
dtm.associate(archive); // or resolve needed types

Try / catch

try {
    trace = dbTrace.openForReading(path);
} catch (IOException e) {
    if (e.getMessage().contains("Missing datatype")) {
        Msg.error(MyClass.class, "Trace references missing data type: " + e.getMessage());
        // Load the appropriate archive and retry
    } else {
        throw e;
    }
}

Prevention

When it happens

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

Common situations: 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.

Related errors


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