{"record":{"id":"2f9490153a2537a7","repo":"NationalSecurityAgency/ghidra","slug":"unsupported-content-type","errorCode":null,"errorMessage":"Unsupported content type: {}","messagePattern":"Unsupported content type: (.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/DBTraceContentHandler.java","lineNumber":62,"sourceCode":"\tprivate static final DBTraceLinkContentHandler LINK_HANDLER = new DBTraceLinkContentHandler();\n\n\t@Override\n\tpublic long createFile(FileSystem fs, FileSystem userfs, String path, String name,\n\t\t\tDomainObject obj, TaskMonitor monitor)\n\t\t\tthrows IOException, InvalidNameException, CancelledException {\n\t\tif (!(obj instanceof DBTrace trace)) {\n\t\t\tthrow new IOException(\"Unsupported domain object: \" + obj.getClass().getName());\n\t\t}\n\t\treturn createFile(trace, TRACE_CONTENT_TYPE, fs, path, name, monitor);\n\t}\n\n\t@Override\n\tpublic DBTrace getImmutableObject(FolderItem item, Object consumer, int version,\n\t\t\tint minChangeVersion, TaskMonitor monitor)\n\t\t\tthrows IOException, CancelledException, VersionException {\n\t\tString contentType = item.getContentType();\n\t\tif (contentType != null && !contentType.equals(TRACE_CONTENT_TYPE)) {\n\t\t\tthrow new IOException(\"Unsupported content type: \" + contentType);\n\t\t}\n\t\tDatabaseItem dbItem = (DatabaseItem) item;\n\t\tManagedBufferFile bf = null;\n\t\tDBHandle dbh = null;\n\t\tDBTrace trace = null;\n\t\tboolean success = false;\n\t\ttry {\n\t\t\tbf = dbItem.open(version, minChangeVersion);\n\t\t\tdbh = new DBHandle(bf);\n\t\t\tOpenMode openMode = OpenMode.IMMUTABLE;\n\t\t\ttrace = new DBTrace(dbh, openMode, monitor, consumer);\n\t\t\tgetTraceChangeSet(trace, bf);\n\t\t\tsuccess = true;\n\t\t\treturn trace;\n\t\t}\n\t\tcatch (VersionException | IOException | CancelledException e) {\n\t\t\tthrow e;\n\t\t}","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/DBTraceContentHandler.java#L44-L80","documentation":"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.","triggerScenarios":"Calling getImmutableObject on a FolderItem whose contentType is not \"Trace\" — opening a Program file via the trace handler, or a corrupted/mislabeled item.","commonSituations":"Content-handler misrouting. A file renamed/converted so its contentType no longer matches. Version upgrade leaving a stale contentType. Mixed shared-project content.","solutions":["Route the item to the content handler matching item.getContentType() (use ContentHandler.getHandler for the type).","If the file genuinely should be a trace, recreate it as a trace file.","Verify item.getContentType() == DBTraceContentHandler.TRACE_CONTENT_TYPE before calling getImmutableObject."],"exampleFix":"// before\nDBTrace t = handler.getImmutableObject(item, consumer, ver, minVer, monitor);\n\n// after\nif (!DBTraceContentHandler.TRACE_CONTENT_TYPE.equals(item.getContentType())) {\n    throw new IOException(\"Item is not a trace: \" + item.getContentType());\n}\nDBTrace t = handler.getImmutableObject(item, consumer, ver, minVer, monitor);","handlingStrategy":"validation","validationCode":"if (!DBTraceContentHandler.TRACE_CONTENT_TYPE.equals(item.getContentType())) {\n    throw new IOException(\"Item is not a trace: \" + item.getContentType());\n}\nDBTrace t = handler.getImmutableObject(item, consumer, ver, minVer, monitor);","typeGuard":"static boolean isTraceItem(FolderItem item) {\n    return DBTraceContentHandler.TRACE_CONTENT_TYPE.equals(item.getContentType());\n}","tryCatchPattern":"try {\n    return handler.getImmutableObject(item, consumer, ver, minVer, monitor);\n} catch (IOException e) {\n    if (e.getMessage().contains(\"Unsupported content type\")) {\n        // dispatch to the handler for item.getContentType()\n    } else throw e;\n}","preventionTips":["Always dispatch open calls via ContentHandler.getHandler(item.getContentType()).","Verify contentType before opening, especially for imported/shared files.","Guard against null contentType by treating it as incompatible unless explicitly expected."],"tags":["content-handler","content-type","domain-object","trace"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}