{"record":{"id":"66d2c7e9cd2e6d5e","repo":"NationalSecurityAgency/ghidra","slug":"file-imported-is-not-a-trace-tracename","errorCode":null,"errorMessage":"File imported is not a Trace: {traceName}","messagePattern":"File imported is not a Trace: (.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/utils/GztLoader.java","lineNumber":100,"sourceCode":"\n\tprivate Trace loadPackedTraceDatabase(ByteProvider provider, String traceName,\n\t\t\tObject consumer, TaskMonitor monitor)\n\t\t\tthrows IOException, CancelledException, VersionException, LanguageNotFoundException {\n\t\tTrace trace;\n\t\tFile file = provider.getFile();\n\t\tFile tmpFile = null;\n\t\tif (file == null) {\n\t\t\tfile = tmpFile = createTmpFile(provider, monitor);\n\t\t}\n\n\t\ttry {\n\t\t\tPackedDatabase packedDatabase = PackedDatabase.getPackedDatabase(file, true, monitor);\n\t\t\tboolean success = false;\n\t\t\tDBHandle dbh = null;\n\t\t\ttry {\n\t\t\t\tif (!DBTraceContentHandler.TRACE_CONTENT_TYPE\n\t\t\t\t\t\t.equals(packedDatabase.getContentType())) {\n\t\t\t\t\tthrow new IOException(\"File imported is not a Trace: \" + traceName);\n\t\t\t\t}\n\n\t\t\t\tmonitor.setMessage(\"Restoring \" + provider.getName());\n\n\t\t\t\tdbh = packedDatabase.open(monitor);\n\n\t\t\t\ttrace = new DBTrace(dbh, OpenMode.UPGRADE, monitor, consumer);\n\t\t\t\tsuccess = true;\n\t\t\t}\n\t\t\tfinally {\n\t\t\t\tif (!success) {\n\t\t\t\t\tif (dbh != null) {\n\t\t\t\t\t\tdbh.close(); // also disposes packed database object\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tpackedDatabase.dispose();\n\t\t\t\t\t}\n\t\t\t\t}","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/utils/GztLoader.java#L82-L118","documentation":"Thrown by GztLoader during import when the packed database's content type does not equal DBTraceContentHandler.TRACE_CONTENT_TYPE. The GZT file was opened successfully as a PackedDatabase, but its content handler indicates it stores something other than a trace, so it cannot be loaded as one. This IOException signals a format/content mismatch.","triggerScenarios":"GztLoader.load() opens PackedDatabase.getPackedDatabase(file, true, monitor), then checks packedDatabase.getContentType() against DBTraceContentHandler.TRACE_CONTENT_TYPE and they don't match. The file is a valid Ghidra packed database but contains a Program, or another content type, not a Trace.","commonSituations":"The user renamed a regular Ghidra program archive (.gzf) to .gzt and tried to import it. The file was exported from a non-debugger context. The packed database's metadata is corrupted, causing the content type to be unreadable or default incorrectly. A version mismatch in the content handler registry.","solutions":["Verify the file was originally exported as a GZT trace from the Ghidra Debugger.","If the file is a regular program archive, import it with the appropriate loader instead of GztLoader.","Re-export the trace from a working debug session to get a valid GZT file.","Check that the Ghidra version used for import matches or is compatible with the version that created the file."],"exampleFix":"// No code fix; the resolution is to use the correct file:\n// Ensure the .gzt file was exported via Debugger > Export Trace, not via Program Export.","handlingStrategy":"validation","validationCode":"// Before importing, check the packed database content type:\nPackedDatabase pdb = PackedDatabase.getPackedDatabase(file, true, monitor);\nif (!DBTraceContentHandler.TRACE_CONTENT_TYPE.equals(pdb.getContentType())) {\n    // inform user: file is not a trace; use a different loader\n}","typeGuard":"boolean isTracePackedDatabase(PackedDatabase pdb) {\n    return DBTraceContentHandler.TRACE_CONTENT_TYPE.equals(pdb.getContentType());\n}","tryCatchPattern":"try {\n    trace = (DBTrace) gztLoader.load(loadSpecs, options, monitor, consumer);\n} catch (IOException e) {\n    if (e.getMessage().startsWith(\"File imported is not a Trace\")) {\n        // select a different loader for this file type\n    } else { throw e; }\n}","preventionTips":["Verify the file was created by the Debugger's trace export, not a regular program export.","Check the file extension and content type before selecting the GZT loader.","Keep trace exports and program exports in separate directories to avoid confusion."],"tags":["import","gzt","trace","content-type","packed-database"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}