NationalSecurityAgency/ghidra · error · IOException

Unsupported domain object: {}

Error message

Unsupported domain object: {}

What it means

DBTraceContentHandler.createFile persists a DomainObject as a trace file. It only accepts DBTrace instances; passing any other DomainObject (e.g. a Program, or a generic DomainObjectProxy) is rejected with IOException because the trace content schema cannot serialize it.

Source

Thrown at Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/DBTraceContentHandler.java:51

import ghidra.util.exception.VersionException;
import ghidra.util.task.TaskMonitor;

public class DBTraceContentHandler extends DBWithUserDataContentHandler<DBTrace> {
	public static final String TRACE_CONTENT_TYPE = "Trace";

	public static final Icon TRACE_ICON = Trace.TRACE_ICON;

	static final Class<DBTrace> TRACE_DOMAIN_OBJECT_CLASS = DBTrace.class;
	static final String TRACE_CONTENT_DEFAULT_TOOL = "Debugger";

	private static final DBTraceLinkContentHandler LINK_HANDLER = new DBTraceLinkContentHandler();

	@Override
	public long createFile(FileSystem fs, FileSystem userfs, String path, String name,
			DomainObject obj, TaskMonitor monitor)
			throws IOException, InvalidNameException, CancelledException {
		if (!(obj instanceof DBTrace trace)) {
			throw new IOException("Unsupported domain object: " + obj.getClass().getName());
		}
		return createFile(trace, TRACE_CONTENT_TYPE, fs, path, name, monitor);
	}

	@Override
	public DBTrace getImmutableObject(FolderItem item, Object consumer, int version,
			int minChangeVersion, TaskMonitor monitor)
			throws IOException, CancelledException, VersionException {
		String contentType = item.getContentType();
		if (contentType != null && !contentType.equals(TRACE_CONTENT_TYPE)) {
			throw new IOException("Unsupported content type: " + contentType);
		}
		DatabaseItem dbItem = (DatabaseItem) item;
		ManagedBufferFile bf = null;
		DBHandle dbh = null;
		DBTrace trace = null;
		boolean success = false;
		try {

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Ensure the DomainObject is actually a DBTrace before calling createFile (instanceof check).
  2. Use the correct content handler for the object's actual type (e.g. ProgramContentHandler for a Program).
  3. If the object should be a trace, construct it as a new DBTrace rather than reusing a Program.

Example fix

// before: handing a Program to the trace handler
handler.createFile(fs, userfs, path, name, program, monitor);

// after: create/save via the matching handler, or confirm the object type
if (!(obj instanceof DBTrace)) {
    throw new IOException("Not a trace: " + obj.getClass().getName());
}
handler.createFile(fs, userfs, path, name, obj, monitor);
Defensive patterns

Strategy: type-guard

Validate before calling

if (!(obj instanceof DBTrace)) {
    throw new IOException("Cannot save non-trace object as trace: " + obj.getClass().getName());
}
handler.createFile(fs, userfs, path, name, obj, monitor);

Type guard

static boolean isTraceDomainObject(DomainObject obj) {
    return obj instanceof DBTrace;
}

Try / catch

try {
    return handler.createFile(fs, userfs, path, name, obj, monitor);
} catch (IOException e) {
    if (e.getMessage().contains("Unsupported domain object")) {
        // route to the content handler matching obj's real type
    } else throw e;
}

Prevention

When it happens

Trigger: Invoking contentHandler.createFile(fs, userfs, path, name, obj, monitor) where obj is a Program, DataTypeArchive, or any DomainObject that is not a DBTrace.

Common situations: Routing a save through the wrong content handler (handler resolution returned DBTraceContentHandler for a non-trace object). Programmatic `domainFile.save()` after the file's content type was changed/lost. Plugin wiring that assumes a trace where a program was opened.

Related errors


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