NationalSecurityAgency/ghidra · error · UnsupportedOperationException
only DBTrace objects are supported
Error message
only DBTrace objects are supported
What it means
Thrown by GztExporter.export() when the DomainObject passed for GZT (Ghidra Zipped Trace) export is not an instance of DBTrace. The exporter's canExportDomainObject() checks DBTrace.class.isAssignableFrom(domainObjectClass), and if it fails, UnsupportedOperationException is thrown — only trace objects can be exported in GZT format.
Source
Thrown at Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/utils/GztExporter.java:65
// Avoid exporting link-files or non-Trace files
return !domainFile.isLink() && canExportDomainObject(domainFile.getDomainObjectClass());
}
@Override
public boolean canExportDomainObject(Class<? extends DomainObject> domainObjectClass) {
return DBTrace.class.isAssignableFrom(domainObjectClass);
}
@Override
public boolean equals(Object obj) {
return (obj instanceof GztExporter);
}
@Override
public boolean export(File file, DomainObject domainObj, AddressSetView addrSet,
TaskMonitor monitor) {
if (!canExportDomainObject(domainObj.getClass())) {
throw new UnsupportedOperationException("only DBTrace objects are supported");
}
try {
file.delete();
domainObj.saveToPackedFile(file, monitor);
}
catch (UnsupportedOperationException e) {
log.appendMsg("Content does not support packed file export!");
log.appendException(e);
return false;
}
catch (CancelledException ce) {
return false;
}
catch (Exception e) {
log.appendMsg("Unexpected exception exporting file: " + e.getMessage());
return false;
}
return true;View on GitHub (pinned to d5f144c24d)
Solutions
- Use a different exporter format (e.g., ELF, PE, or Ghidra ZIP) for non-trace DomainObjects.
- Only invoke GZT export on trace objects from the Debugger's Trace view.
- If scripting, verify the DomainObject type before calling export: check instanceOf DBTrace.
- Ensure the export action's availability is gated by canExportDomainObject in the UI layer.
Example fix
// Before:
// exporter.export(file, program, addrSet, monitor); // program is not DBTrace
//
// After:
// if (domainObj instanceof DBTrace) {
// exporter.export(file, domainObj, addrSet, monitor);
// } else {
// // use appropriate program exporter
// } Defensive patterns
Strategy: validation
Validate before calling
// Before calling export, check the DomainObject type:
if (GztExporter.INSTANCE.canExportDomainObject(domainObj.getClass())) {
exporter.export(file, domainObj, addrSet, monitor);
} else {
// use a different exporter
} Type guard
boolean isDBTrace(DomainObject obj) {
return obj instanceof DBTrace;
} Try / catch
try {
exporter.export(file, domainObj, addrSet, monitor);
} catch (UnsupportedOperationException e) {
if (e.getMessage().equals("only DBTrace objects are supported")) {
// select a different exporter for this object type
} else { throw e; }
} Prevention
- Always call canExportDomainObject() before export().
- Gate the GZT export action in the UI to only show for DBTrace objects.
- In scripts, check instanceof DBTrace before selecting the GZT exporter.
When it happens
Trigger: GztExporter.export(File, DomainObject, AddressSetView, TaskMonitor) receives a DomainObject that is a regular Program (not a DBTrace). canExportDomainObject(domainObj.getClass()) returns false. This happens when the export action is invoked on a non-trace DomainObject, or when the wrong exporter is selected for a program export.
Common situations: The user selects 'Export Program > GZT' on a standard binary program (not a debug trace). A plugin or script calls the exporter programmatically with a Program instead of a DBTrace. The export dialog allows selecting GZT format for non-trace objects.
Related errors
- only DBTrace files are supported
- File imported is not a Trace: {traceName}
- Cannot add GZT to program
- Unsupported domain object: {}
- Unsupported content type: {}
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/f9b8ff6497a7634d.
Report an issue: GitHub.