{"record":{"id":"f9b8ff6497a7634d","repo":"NationalSecurityAgency/ghidra","slug":"only-dbtrace-objects-are-supported","errorCode":null,"errorMessage":"only DBTrace objects are supported","messagePattern":"only DBTrace objects are supported","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/utils/GztExporter.java","lineNumber":65,"sourceCode":"\t\t// Avoid exporting link-files or non-Trace files\n\t\treturn !domainFile.isLink() && canExportDomainObject(domainFile.getDomainObjectClass());\n\t}\n\n\t@Override\n\tpublic boolean canExportDomainObject(Class<? extends DomainObject> domainObjectClass) {\n\t\treturn DBTrace.class.isAssignableFrom(domainObjectClass);\n\t}\n\n\t@Override\n\tpublic boolean equals(Object obj) {\n\t\treturn (obj instanceof GztExporter);\n\t}\n\n\t@Override\n\tpublic boolean export(File file, DomainObject domainObj, AddressSetView addrSet,\n\t\t\tTaskMonitor monitor) {\n\t\tif (!canExportDomainObject(domainObj.getClass())) {\n\t\t\tthrow new UnsupportedOperationException(\"only DBTrace objects are supported\");\n\t\t}\n\t\ttry {\n\t\t\tfile.delete();\n\t\t\tdomainObj.saveToPackedFile(file, monitor);\n\t\t}\n\t\tcatch (UnsupportedOperationException e) {\n\t\t\tlog.appendMsg(\"Content does not support packed file export!\");\n\t\t\tlog.appendException(e);\n\t\t\treturn false;\n\t\t}\n\t\tcatch (CancelledException ce) {\n\t\t\treturn false;\n\t\t}\n\t\tcatch (Exception e) {\n\t\t\tlog.appendMsg(\"Unexpected exception exporting file: \" + e.getMessage());\n\t\t\treturn false;\n\t\t}\n\t\treturn true;","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/utils/GztExporter.java#L47-L83","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// Before:\n// exporter.export(file, program, addrSet, monitor); // program is not DBTrace\n//\n// After:\n// if (domainObj instanceof DBTrace) {\n//     exporter.export(file, domainObj, addrSet, monitor);\n// } else {\n//     // use appropriate program exporter\n// }","handlingStrategy":"validation","validationCode":"// Before calling export, check the DomainObject type:\nif (GztExporter.INSTANCE.canExportDomainObject(domainObj.getClass())) {\n    exporter.export(file, domainObj, addrSet, monitor);\n} else {\n    // use a different exporter\n}","typeGuard":"boolean isDBTrace(DomainObject obj) {\n    return obj instanceof DBTrace;\n}","tryCatchPattern":"try {\n    exporter.export(file, domainObj, addrSet, monitor);\n} catch (UnsupportedOperationException e) {\n    if (e.getMessage().equals(\"only DBTrace objects are supported\")) {\n        // select a different exporter for this object type\n    } else { throw e; }\n}","preventionTips":["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."],"tags":["export","gzt","trace","domain-object","type-mismatch"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}