NationalSecurityAgency/ghidra · error · IOException
File does not correspond to Program content: {}
Error message
File does not correspond to Program content: {} What it means
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.
Source
Thrown at Ghidra/Debug/Debugger-isf/src/main/java/ghidra/dbg/isf/IsfServer.java:125
}
else {
dtm = openAsProgramFile(ns);
}
managers.put(ns, dtm);
return dtm;
}
catch (Exception e) {
Msg.error(this, ns + " undefined namespace (should be .gdt, .gzf, or domain file)");
return null;
}
}
}
private DataTypeManager openAsProgramFile(String ns) throws Exception {
ProjectData projectData = project.getProjectData();
DomainFile df = projectData.getFile(ns);
if (!Program.class.isAssignableFrom(df.getDomainObjectClass())) {
throw new IOException("File does not correspond to Program content: " + ns);
}
// FIXME: Need to track and release Program instance after DTM use is complete (GP-6895)
Program program = (Program) df.getDomainObject(this, false, false, TaskMonitor.DUMMY);
return program.getDataTypeManager();
}
private DataTypeManager openAsDataTypeArchive(String ns) throws Exception {
File gdt = new File(ns);
return FileDataTypeManager.openFileArchive(gdt, false);
}
private DataTypeManager openAsProgramDatabase(String ns) throws Exception {
File gzf = new File(ns);
TaskMonitor dummy = TaskMonitor.DUMMY;
PackedDatabase db = PackedDatabase.getPackedDatabase(gzf, dummy);
DBHandle dbh = db.openForUpdate(dummy);View on GitHub (pinned to d5f144c24d)
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.
Example fix
// before
DataTypeManager dtm = openAsProgramFile(ns); // ns points at a .gdt
// after
if (ns.endsWith(".gdt") || ns.endsWith(".gzf")) {
dtm = openAsDataTypeArchive(ns);
} else {
DomainFile df = project.getProjectData().getFile(ns);
if (!Program.class.isAssignableFrom(df.getDomainObjectClass())) {
throw new IOException(ns + " is not a Program; use a .gdt archive or a program domain file");
}
dtm = openAsProgramFile(ns);
} Defensive patterns
Strategy: validation
Validate before calling
DomainFile df = project.getProjectData().getFile(ns);
if (df == null || !Program.class.isAssignableFrom(df.getDomainObjectClass())) {
// route to openAsDataTypeArchive or reject with a clear message
} Try / catch
try {
dtm = server.openAsProgramFile(ns);
} catch (IOException e) {
if (e.getMessage().contains("Program content")) {
// try archive resolution or ask for a Program namespace
}
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Selected file is not a program
- Selected file is not a program
- Null datatype passed to getIsfObject
- Unsupported value: {}
- Invalid value for {}
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/3d5ae8dbe251da1a.
Report an issue: GitHub.