NationalSecurityAgency/ghidra · error · LoadException
Cannot add Trace to a program
Error message
Cannot add Trace to a program
What it means
TenetLoader.loadInto(Program, ImporterSettings) is overridden to unconditionally throw LoadException('Cannot add Trace to a program'). A Tenet trace is itself a separate Trace domain object, not something that can be merged into an existing Program; the API entry point that would imply that is therefore forbidden.
Source
Thrown at Ghidra/Debug/Debugger-importers/src/main/java/ghidra/app/util/opinion/TenetLoader.java:318
.appendMsg("%d ms to load trace | %d ms to flush cache | %d ms total time"
.formatted(loadDone - start, flushDone - loadDone, flushDone - start));
return new LoadResults<>(new Loaded<>(trace, settings));
}
catch (final CancelledException e) {
throw e;
}
finally {
if (program != null) {
program.release(this);
}
}
}
@Override
public void loadInto(final Program program, final ImporterSettings settings)
throws IOException, LoadException, CancelledException {
throw new LoadException("Cannot add Trace to a program");
}
private Trace loadTrace(final ByteProvider provider, final String name, final Program program,
final Object consumer, final MessageLog log, final TaskMonitor monitor)
throws LanguageNotFoundException, IOException, CancelledException {
this.program = program;
final Language lang = program.getLanguage();
this.defaultSpace = lang.getAddressFactory().getDefaultAddressSpace();
final Trace trace = new DBTrace(name, program.getCompilerSpec(), consumer);
final TraceObjectManager om = trace.getObjectManager();
try (Transaction tx = trace.openTransaction("Import Tenet Trace: %s".formatted(name));
BypassWriteCache bypass = om.withoutWriteCache()) {
om.createRootObject(TENET_SESSION_SCHEMA);
View on GitHub (pinned to d5f144c24d)
Solutions
- Do not call loadInto on TenetLoader; use load() / loadTrace(...) which produces a new Trace domain object.
- If writing a generic loader dispatcher, skip loaders whose loadInto throws this contract violation, or check the loader type first.
- Report to the caller that traces are created as new domain objects, not merged into programs.
Defensive patterns
Strategy: validation
Validate before calling
if (loader instanceof TenetLoader) {
// use load() to create a new Trace; never loadInto()
} Try / catch
try {
loader.loadInto(program, settings);
} catch (LoadException e) {
if (e.getMessage().contains("Cannot add Trace to a program")) {
// fall back to load() to create a standalone Trace
}
} Prevention
- Never call loadInto on trace loaders; use load() to create a new Trace domain object.
- In generic loader dispatchers, skip or special-case trace loaders for the loadInto path.
- Remember traces are standalone objects, not merge targets.
When it happens
Trigger: The framework or a caller invokes loadInto(program, settings) on TenetLoader instead of the full load() that creates a new Trace. This is a deliberate API guard: trace loaders do not support adding into a program.
Common situations: A generic importer harness that loops over loaders and calls loadInto on each, hitting the trace loader; a script that assumed loadInto was uniformly supported across all loaders.
Related errors
- Cannot add Trace to a program
- No progam to associate with trace was given
- Encountered too many errors with this trace
- No progam to associate with trace was given
- Selected file is not a program
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/4f8bb56b703480e0.
Report an issue: GitHub.