{"record":{"id":"28cc2efa86a53bf9","repo":"NationalSecurityAgency/ghidra","slug":"instruction-table-is-corrupt-missing-platform-p","errorCode":null,"errorMessage":"Instruction table is corrupt. Missing platform: {platformKey}","messagePattern":"Instruction 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/DBTraceInstruction.java","lineNumber":227,"sourceCode":"\t\tif (forcedLengthOverride != 0) {\n\t\t\tupdateLengthOverride(forcedLengthOverride);\n\t\t}\n\n\t\t// TODO: Can there be more in this context than the context register???\n\t\tdoSetPlatformMapping(platform);\n\t\tthis.prototype = prototype;\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\t// Wait for something to set prototype\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(\"Instruction table is corrupt. Missing platform: \" + platformKey);\n\t\t}\n\t\tprototype = space.manager.getPrototypeByKey(prototypeKey);\n\t\tif (prototype == null) {\n\t\t\tMsg.error(this, \"Instruction table is corrupt for address \" + getMinAddress() +\n\t\t\t\t\". Missing prototype \" + prototypeKey);\n\t\t\tprototype = new InvalidPrototype(getTrace().getBaseLanguage());\n\t\t}\n\t\tflowOverride =\n\t\t\tFlowOverride.values()[(flags & FLOW_OVERRIDE_SET_MASK) >> FLOW_OVERRIDE_SHIFT];\n\n\t\tlengthOverride = (flags & LENGTH_OVERRIDE_SET_MASK) >> LENGTH_OVERRIDE_SHIFT;\n\t\tif (lengthOverride != 0 && lengthOverride < prototype.getLength()) {\n\t\t\tAddress minAddr = getMinAddress();\n\t\t\tAddress newEndAddr = minAddr.add(lengthOverride - 1);\n\t\t\tdoSetRange(new AddressRangeImpl(minAddr, newEndAddr));\n\t\t}\n\n\t\tdoSetPlatformMapping(platform);","sourceCodeStart":209,"sourceCodeEnd":245,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/listing/DBTraceInstruction.java#L209-L245","documentation":"Thrown by DBTraceInstruction.fresh() when loading an instruction record and the stored platformKey does not resolve via platformManager.getPlatformByKey(). This is the instruction-table equivalent of error 448 (which is for data) — the persisted instruction references a platform that no longer exists in the platform manager. The IOException indicates trace database corruption or an inconsistent save state.","triggerScenarios":"Opening a trace database where a DBTraceInstruction record has a platformKey with no matching platform. Occurs during the fresh(false) deserialization path when the instruction record is loaded but its platform cannot be found.","commonSituations":"Trace corruption from crash/concurrent write; guest platform removed or its key reassigned after the trace was written; version incompatibility between trace writer and reader; manual database editing.","solutions":["Restore the trace from a known-good backup.","Re-add the guest platform with the same key before opening the trace.","Verify Ghidra version compatibility and report as a corruption bug if it occurs under normal single-session use.","Ensure no concurrent trace access from multiple processes."],"exampleFix":"// before — trace opens with corrupted instruction records\n// throws IOException: Missing platform: 2\n\n// after — restore backup or re-register the guest platform\n// Re-add the guest platform that maps to key 2:\ntrace.getPlatformManager().addGuestPlatform(guestLanguage);\n// then reopen the trace\n// Alternatively: restore from backup","handlingStrategy":"try-catch","validationCode":"// Cannot pre-validate individual instruction records; ensure platform integrity\n// at the trace level before opening. This is a deserialization-time corruption error.\n// Ensure the same platform set exists when reopening the trace.","typeGuard":null,"tryCatchPattern":"try {\n    trace = dbTrace.openForReading(path);\n} catch (IOException e) {\n    if (e.getMessage().contains(\"Instruction table is corrupt\") ||\n        e.getMessage().contains(\"Missing platform\")) {\n        Msg.error(MyClass.class, \"Corrupt trace: \" + e.getMessage());\n        // Restore from backup or re-register the platform\n    } else {\n        throw e;\n    }\n}","preventionTips":["Always close traces properly to flush all records.","Never share trace files across concurrent processes.","Keep backups; re-register guest platforms with matching keys before reopening.","Use consistent Ghidra versions across create and open."],"tags":["data-corruption","database","platform","instruction","trace-modeling"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}