{"record":{"id":"c0b5c6a932f03b10","repo":"NationalSecurityAgency/ghidra","slug":"data-table-is-corrupt-missing-platform-platform","errorCode":null,"errorMessage":"Data table is corrupt. Missing platform: {platformKey}","messagePattern":"Data table is corrupt\\. Missing platform: (.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"critical","filePath":"Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/listing/DBTraceData.java","lineNumber":93,"sourceCode":"\t * @param tree the storage R*-Tree\n\t * @param store the object store\n\t * @param record the record\n\t */\n\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}","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/listing/DBTraceData.java#L75-L111","documentation":"Thrown by DBTraceData.fresh() when loading a data unit record from the database and the stored platformKey does not resolve to a known platform via platformManager.getPlatformByKey(). This indicates database corruption — a data unit record references a platform that no longer exists in the trace's platform manager. The IOException signals that the persisted trace is internally inconsistent and cannot be reliably loaded.","triggerScenarios":"Loading/opening a trace database where a DBTraceData record has a platformKey column value that has no corresponding entry in the platform manager's platform table. This happens during deserialization of trace data units (the fresh(false) path).","commonSituations":"Trace file corruption from incomplete writes, crashes, or concurrent access without proper locking; manual editing of the underlying database; trace created with a guest platform that was later removed or whose key allocation changed; version incompatibility between the writer and reader of the trace format.","solutions":["Restore the trace from a known-good backup.","If the platform was legitimately removed, re-add the guest platform with the same key before opening.","Report the corruption — this is a data integrity issue that should not occur under normal operation; check for concurrent-write or crash scenarios.","Ensure you are using the same (or compatible) Ghidra version that created the trace."],"exampleFix":"// before — trace opens with corrupted data records\n// throws IOException: Missing platform: 3\n\n// after — re-add the platform or restore backup\n// Re-register the guest platform that has key 3:\ntrace.getPlatformManager().addGuestPlatform(language); // if API allows\n// Otherwise: restore from backup trace file","handlingStrategy":"try-catch","validationCode":"// Before opening, verify the trace file is not corrupt (limited pre-check)\n// This is a deserialization-time error; pre-validation requires\n// checking the platform table integrity:\n// (platform repair must happen at the trace/platform level, not per-record)","typeGuard":null,"tryCatchPattern":"try {\n    trace = dbTrace.openForReading(path);\n} catch (IOException e) {\n    if (e.getMessage().contains(\"Missing platform\")) {\n        Msg.error(MyClass.class, \"Trace is corrupt: \" + e.getMessage());\n        // Attempt recovery: restore from backup or skip affected records\n    } else {\n        throw e;\n    }\n}","preventionTips":["Always close traces properly with try-with-resources to avoid incomplete writes.","Never access the same trace file from multiple processes simultaneously.","Keep backups of important traces.","Use the same Ghidra version for creating and opening traces."],"tags":["data-corruption","database","platform","trace-modeling"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}