NationalSecurityAgency/ghidra · critical · IOException
Trace Bytes table is corrupt
Error message
Trace Bytes table is corrupt
What it means
Thrown by DBTraceMemoryBlockEntry.findAssignedBuffer() when the block has a valid bufferKey (!= -1) but the buffer store returns null for that key via space.bufferStore.getObjectAt(bufferKey). This indicates the trace's Bytes table is internally inconsistent: a block references a buffer that no longer exists. An IOException (checked) signals database corruption that cannot be recovered programmatically.
Source
Thrown at Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/memory/DBTraceMemoryBlockEntry.java:172
protected DBTraceMemoryBufferEntry findFreeBuffer() throws IOException {
DBTraceMemoryBufferEntry ent = findFreeBufferInPast();
if (ent != null) {
return ent;
}
ent = findFreeBufferInFuture();
if (ent != null) {
return ent;
}
return allocateNewBuffer();
}
protected DBTraceMemoryBufferEntry findAssignedBuffer() throws IOException {
if (bufferKey == -1) {
return null;
}
DBTraceMemoryBufferEntry bufEnt = space.bufferStore.getObjectAt(bufferKey);
if (bufEnt == null) {
throw new IOException("Trace Bytes table is corrupt");
}
return bufEnt;
}
protected static boolean isZeroes(ByteBuffer buf, int len) {
int pos = buf.position();
for (int i = 0; i < len; i++) {
if (buf.get(pos + i) != 0) {
return false;
}
}
return true;
}
public int setBytes(ByteBuffer buf, int dstOffset, int len) throws IOException {
DBTraceMemoryBufferEntry bufEnt = findAssignedBuffer();
if (bufEnt == null) {
if (isZeroes(buf, len)) {View on GitHub (pinned to d5f144c24d)
Solutions
- Restore the trace database from a known-good backup.
- Re-create the trace by re-importing or re-recording the debugging session.
- Run Ghidra's database repair/upgrade tools if available.
- If the corruption is limited to one block, consider clearing and re-recording memory for that address range.
Defensive patterns
Strategy: fallback
Try / catch
try {
byte[] bytes = memory.getBytes(addr, buf);
} catch (IOException e) {
if (e.getMessage().contains("corrupt")) {
// trace database corruption — restore from backup or re-record
logger.severe("Trace database corruption detected: " + e.getMessage());
}
} Prevention
- Maintain backups of trace databases.
- Use proper shutdown procedures for Ghidra to avoid database corruption.
- Monitor disk health to prevent write corruption.
- Re-record traces from the original debugging sessions when corruption occurs.
When it happens
Trigger: Reading trace memory when a DBTraceMemoryBlockEntry references a bufferKey in the buffer store, but the DBTraceMemoryBufferEntry at that key has been deleted or was never written. This occurs during getBytes(), findAssignedBuffer(), or buffer allocation paths.
Common situations: Database file corruption due to improper shutdown, disk failure, or concurrent access issues. Trace database was partially written or interrupted during save. Version mismatch or incomplete upgrade of the trace database format. Manual editing or external corruption of the .gdb database files.
Related errors
- compressed memory buffer is corrupt
- Open failed: {}
- Failed to read {len} bytes at {addr}
- Trace does not contain referenced instruction: ({getStartSna
- Instruction has incompatible prototype at: ({getStartSnap},{
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/e45a5a11ab341316.
Report an issue: GitHub.