{"record":{"id":"3d5ae8dbe251da1a","repo":"NationalSecurityAgency/ghidra","slug":"file-does-not-correspond-to-program-content","errorCode":null,"errorMessage":"File does not correspond to Program content: {}","messagePattern":"File does not correspond to Program content: (.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"Ghidra/Debug/Debugger-isf/src/main/java/ghidra/dbg/isf/IsfServer.java","lineNumber":125,"sourceCode":"\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tdtm = openAsProgramFile(ns);\n\t\t\t\t}\n\t\t\t\tmanagers.put(ns, dtm);\n\t\t\t\treturn dtm;\n\t\t\t}\n\t\t\tcatch (Exception e) {\n\t\t\t\tMsg.error(this, ns + \" undefined namespace (should be .gdt, .gzf, or domain file)\");\n\t\t\t\treturn null;\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate DataTypeManager openAsProgramFile(String ns) throws Exception {\n\t\tProjectData projectData = project.getProjectData();\n\t\tDomainFile df = projectData.getFile(ns);\n\t\tif (!Program.class.isAssignableFrom(df.getDomainObjectClass())) {\n\t\t\tthrow new IOException(\"File does not correspond to Program content: \" + ns);\n\t\t}\n\n\t\t// FIXME: Need to track and release Program instance after DTM use is complete (GP-6895)\n\t\tProgram program = (Program) df.getDomainObject(this, false, false, TaskMonitor.DUMMY);\n\t\treturn program.getDataTypeManager();\n\t}\n\n\tprivate DataTypeManager openAsDataTypeArchive(String ns) throws Exception {\n\t\tFile gdt = new File(ns);\n\t\treturn FileDataTypeManager.openFileArchive(gdt, false);\n\t}\n\n\tprivate DataTypeManager openAsProgramDatabase(String ns) throws Exception {\n\t\tFile gzf = new File(ns);\n\t\tTaskMonitor dummy = TaskMonitor.DUMMY;\n\t\tPackedDatabase db = PackedDatabase.getPackedDatabase(gzf, dummy);\n\n\t\tDBHandle dbh = db.openForUpdate(dummy);","sourceCodeStart":107,"sourceCodeEnd":143,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Debugger-isf/src/main/java/ghidra/dbg/isf/IsfServer.java#L107-L143","documentation":"IOException('File does not correspond to Program content: ' + ns) thrown by IsfServer.openAsProgramFile when a namespace resolves to a domain file whose domain object class is not assignable to Program. The method resolves df via project.getProjectData().getFile(ns) and checks Program.class.isAssignableFrom(df.getDomainObjectClass()). There is also a FIXME noting the Program instance is not released after DTM use (GP-6895), a separate resource leak.","triggerScenarios":"An ISF client requests a namespace that maps to a non-Program domain file (a Trace, a data-type archive opened as a domain file, or a folder). openAsProgramFile is one of several resolution strategies; this one rejects anything that is not Program content.","commonSituations":"Client passes a namespace string that names a .gdt archive or an existing Trace instead of a Program; the namespace was meant for openAsDataTypeArchive but routing tried program resolution first; stale project state where a file's type changed.","solutions":["Supply a namespace that resolves to a Program domain file when requesting program-backed types.","For archive namespaces, route to the .gdt path (openAsDataTypeArchive) instead of program resolution.","Validate df.getDomainObjectClass() with Program.class.isAssignableFrom(...) before calling and pick the correct resolver branch.","Watch the resource leak noted by the FIXME: ensure any opened Program is released after use."],"exampleFix":"// before\nDataTypeManager dtm = openAsProgramFile(ns); // ns points at a .gdt\n\n// after\nif (ns.endsWith(\".gdt\") || ns.endsWith(\".gzf\")) {\n    dtm = openAsDataTypeArchive(ns);\n} else {\n    DomainFile df = project.getProjectData().getFile(ns);\n    if (!Program.class.isAssignableFrom(df.getDomainObjectClass())) {\n        throw new IOException(ns + \" is not a Program; use a .gdt archive or a program domain file\");\n    }\n    dtm = openAsProgramFile(ns);\n}","handlingStrategy":"validation","validationCode":"DomainFile df = project.getProjectData().getFile(ns);\nif (df == null || !Program.class.isAssignableFrom(df.getDomainObjectClass())) {\n    // route to openAsDataTypeArchive or reject with a clear message\n}","typeGuard":null,"tryCatchPattern":"try {\n    dtm = server.openAsProgramFile(ns);\n} catch (IOException e) {\n    if (e.getMessage().contains(\"Program content\")) {\n        // try archive resolution or ask for a Program namespace\n    }\n}","preventionTips":["Use a Program domain file for program-backed namespaces; .gdt for archives.","Check getDomainObjectClass() assignability before resolving as a program.","Mind the FIXME: release any opened Program after DTM use."],"tags":["ghidra","isf","program","domain-file","validation"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}