NationalSecurityAgency/ghidra · error · IOException

Unsupported content type

Error message

Unsupported content type: {}

What it means

getImmutableObject opens a FolderItem as an immutable DBTrace. It checks the item's stored contentType equals "Trace"; a different stored type (e.g. "Program", "DataTypeArchive", or a legacy/unknown type) means the file is not a trace database and cannot be opened by this handler.

Solutions

  1. Route the item to the content handler matching item.getContentType() (use ContentHandler.getHandler for the type).
  2. If the file genuinely should be a trace, recreate it as a trace file.
  3. Verify item.getContentType() == DBTraceContentHandler.TRACE_CONTENT_TYPE before calling getImmutableObject.

Example fix

// before
DBTrace t = handler.getImmutableObject(item, consumer, ver, minVer, monitor);

// after
if (!DBTraceContentHandler.TRACE_CONTENT_TYPE.equals(item.getContentType())) {
    throw new IOException("Item is not a trace: " + item.getContentType());
}
DBTrace t = handler.getImmutableObject(item, consumer, ver, minVer, monitor);
Defensive patterns

Strategy: validation

Validate before calling

if (!DBTraceContentHandler.TRACE_CONTENT_TYPE.equals(item.getContentType())) {
    throw new IOException("Item is not a trace: " + item.getContentType());
}
DBTrace t = handler.getImmutableObject(item, consumer, ver, minVer, monitor);

Type guard

static boolean isTraceItem(FolderItem item) {
    return DBTraceContentHandler.TRACE_CONTENT_TYPE.equals(item.getContentType());
}

Try / catch

try {
    return handler.getImmutableObject(item, consumer, ver, minVer, monitor);
} catch (IOException e) {
    if (e.getMessage().contains("Unsupported content type")) {
        // dispatch to the handler for item.getContentType()
    } else throw e;
}

Prevention

When it happens

Trigger: Calling getImmutableObject on a FolderItem whose contentType is not "Trace" — opening a Program file via the trace handler, or a corrupted/mislabeled item.

Common situations: Content-handler misrouting. A file renamed/converted so its contentType no longer matches. Version upgrade leaving a stale contentType. Mixed shared-project content.

Related errors


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

Appendix: source

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

	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 {
			bf = dbItem.open(version, minChangeVersion);
			dbh = new DBHandle(bf);
			OpenMode openMode = OpenMode.IMMUTABLE;
			trace = new DBTrace(dbh, openMode, monitor, consumer);
			getTraceChangeSet(trace, bf);
			success = true;
			return trace;
		}
		catch (VersionException | IOException | CancelledException e) {
			throw e;
		}

View on GitHub (pinned to d5f144c24d)