NationalSecurityAgency/ghidra · error · UnsupportedOperationException

only DBTrace files are supported

Error message

only DBTrace files are supported

What it means

Thrown by GztExporter.export() overload when the DomainFile passed for GZT export does not represent a DBTrace file. The canExportDomainFile() check fails, and UnsupportedOperationException is thrown. This is the DomainFile variant of error 107 — it checks the file's content type rather than the object's class.

Source

Thrown at Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/utils/GztExporter.java:90

			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;
	}

	@Override
	public boolean export(File file, DomainFile domainFile, TaskMonitor monitor)
			throws ExporterException, IOException {
		if (!canExportDomainFile(domainFile)) {
			throw new UnsupportedOperationException("only DBTrace files are supported");
		}
		try {
			domainFile.packFile(file, monitor);
		}
		catch (CancelledException e) {
			return false;
		}
		catch (Exception e) {
			log.appendMsg("Unexpected exception exporting file: " + e.getMessage());
			return false;
		}
		return true;
	}

	@Override
	public List<Option> getOptions(DomainObjectService domainObjectService) {
		return EMPTY_OPTIONS;
	}

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Select only trace files (created by the Debugger) for GZT export.
  2. Filter DomainFiles by content type before calling export in scripts.
  3. Use the correct exporter for the file's actual content type.
  4. Check canExportDomainFile() before invoking export to avoid the exception.

Example fix

// Before:
// exporter.export(file, domainFile, monitor); // domainFile is not a trace
//
// After:
// if (exporter.canExportDomainFile(domainFile)) {
//     exporter.export(file, domainFile, monitor);
// }
Defensive patterns

Strategy: validation

Validate before calling

// Before calling export with a DomainFile, check capability:
if (exporter.canExportDomainFile(domainFile)) {
    exporter.export(file, domainFile, monitor);
} else {
    // use a different exporter
}

Type guard

// No simple type guard on DomainFile; use canExportDomainFile() check.
boolean isTraceFile(DomainFile df) {
    return DBTraceContentHandler.TRACE_CONTENT_TYPE.equals(df.getContentType());
}

Try / catch

try {
    exporter.export(file, domainFile, monitor);
} catch (UnsupportedOperationException e) {
    if (e.getMessage().equals("only DBTrace files are supported")) {
        // select a different exporter for this file type
    } else { throw e; }
}

Prevention

When it happens

Trigger: GztExporter.export(File, DomainFile, TaskMonitor) receives a DomainFile whose underlying content is not a DBTrace. canExportDomainFile(domainFile) returns false. This happens when the user picks a non-trace file from the project tree for GZT export.

Common situations: The user right-clicks a regular program file in the project tree and selects GZT export. A batch export script iterates over DomainFiles and attempts GZT on all of them. The file is a folder, or a non-trace content type.

Related errors


AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14). Data as JSON: /api/errors/f884aeec3d94f8a2. Report an issue: GitHub.