NationalSecurityAgency/ghidra · error · IllegalArgumentException
The given program is dynamic, i.e., a trace view
Error message
The given program is dynamic, i.e., a trace view
What it means
Thrown by FlatDebuggerAPI.staticLocation(program, address) when the supplied program is actually a TraceProgramView (a dynamic trace adapter), not a static program. The method is specifically for static program locations.
Source
Thrown at Ghidra/Debug/Debugger-api/src/main/java/ghidra/debug/flatapi/FlatDebuggerAPI.java:1905
/**
* Get the breakpoint service
*
* @return the service
*/
default DebuggerLogicalBreakpointService getBreakpointService() {
return requireService(DebuggerLogicalBreakpointService.class);
}
/**
* Create a static location at the given address in the current program
*
* @param program the (static) program
* @param address the address
* @return the location
*/
default ProgramLocation staticLocation(Program program, Address address) {
if (program instanceof TraceProgramView) {
throw new IllegalArgumentException("The given program is dynamic, i.e., a trace view");
}
return new ProgramLocation(program, address);
}
/**
* Create a static location at the given address in the current program
*
* @param program the (static) program
* @param addrString the address string
* @return the location
*/
default ProgramLocation staticLocation(Program program, String addrString) {
return staticLocation(program, program.getAddressFactory().getAddress(addrString));
}
/**
* Create a static location at the given address in the current program
* View on GitHub (pinned to d5f144c24d)
Solutions
- Check !(program instanceof TraceProgramView) before calling staticLocation().
- Use requireCurrentProgram() which returns the static program, or explicitly obtain the static program.
- For dynamic locations, use the trace-view-based location API instead.
Example fix
// before
ProgramLocation loc = staticLocation(getCurrentProgram(), addr); // throws if it's a view
// after
Program p = getCurrentProgram();
if (p instanceof TraceProgramView) {
println("Need a static program, not a trace view");
return;
}
ProgramLocation loc = staticLocation(p, addr); Defensive patterns
Strategy: type-guard
Validate before calling
if (program instanceof TraceProgramView) {
println("Need a static program, got a trace view");
return;
} Type guard
static boolean isStaticProgram(Program p) {
return !(p instanceof TraceProgramView);
} Try / catch
try {
ProgramLocation loc = staticLocation(program, addr);
} catch (IllegalArgumentException e) {
if (e.getMessage().contains("dynamic")) {
// obtain the static program explicitly and retry
} else throw e;
} Prevention
- Check !(program instanceof TraceProgramView) before static-only APIs.
- Distinguish static programs from trace views in debugger tool scripts.
When it happens
Trigger: Calling staticLocation(program, addr) where program is an instance of TraceProgramView (i.e., a trace being viewed as a program).
Common situations: Passing the current program without checking whether it is a static program or a trace view; in the Debugger tool the 'current program' may resolve to a trace view; confusing the static and dynamic program concepts.
Related errors
- There is no current trace view
- For parameter %s: argument %s is not a %s
- Tool does not have service {cls}! This script should be run
- There is no current trace
- There is no trace
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/40715aad1b1919fe.
Report an issue: GitHub.