NationalSecurityAgency/ghidra · error · IllegalArgumentException
Sleigh language required
Error message
Sleigh language required
What it means
Thrown by the DebuggerEmulateFunctionDialog constructor when the selected Function's program is not backed by a SleighLanguage. SleighLanguage is Ghidra's p-code processor specification; the emulator and the dialog's VarStorage/executor machinery all depend on it. Non-Sleigh Language implementations (legacy or custom) cannot drive p-code emulation, so the dialog refuses to open.
Source
Thrown at Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/emulation/DebuggerEmulateFunctionDialog.java:202
@Override
public ActionContext getActionContext(MouseEvent e) {
return new OutputActionContext(outputsFilterPanel.getSelectedItems());
}
};
protected final DomainObjectListener listenerForFunction = new DomainObjectListenerBuilder(this)
.any(DomainObjectEvent.RESTORED)
.terminate(inputActions::contextChanged)
.with(FunctionChangeRecord.class)
.each(ProgramEvent.FUNCTION_CHANGED)
.call(this::functionChanged)
.build();
public DebuggerEmulateFunctionDialog(PluginTool tool, Function function) {
super("Emulate %s of %s".formatted(function.getName(), function.getProgram().getName()),
false, true, true, true);
if (!(function.getProgram().getLanguage() instanceof SleighLanguage language)) {
throw new IllegalArgumentException("Sleigh language required");
}
this.tool = tool;
this.function = function;
this.language = language;
inputsTableModel = new InputsTableModel(tool, this);
outputsTableModel = new OutputsTableModel(tool, this);
inputsTableModel.addTableModelListener(evt -> {
inputActions.contextChanged();
});
outputsTableModel.addTableModelListener(evt -> {
outputActions.contextChanged();
});
sentinel = language.getDefaultSpace().getAddress(0xdeadbeef);
snapshotPeriod = 1;
nextAlloc = language.getDefaultDataSpace().getAddress(0x7beef000);View on GitHub (pinned to d5f144c24d)
Solutions
- Re-import the program with a current Sleigh-based processor specification (.pspec/.sleigh) so its Language is a SleighLanguage.
- Verify via function.getProgram().getLanguage() instanceof SleighLanguage before launching the emulation dialog, and warn the user instead of constructing it.
- If working with a custom processor, ensure its Language implementation extends SleighLanguage.
- Skip the Emulate Function action for programs known to use non-Sleigh languages.
Example fix
// before
new DebuggerEmulateFunctionDialog(tool, function); // throws if non-Sleigh
// after
if (function.getProgram().getLanguage() instanceof SleighLanguage) {
new DebuggerEmulateFunctionDialog(tool, function);
} else {
Msg.showWarn(this, null, "Cannot Emulate",
"Emulation requires a program using a Sleigh language.");
} Defensive patterns
Strategy: type-guard
Validate before calling
boolean canEmulate = function.getProgram().getLanguage() instanceof SleighLanguage;
Type guard
static boolean isSleigh(Function f) {
return f.getProgram().getLanguage() instanceof SleighLanguage;
} Try / catch
try {
new DebuggerEmulateFunctionDialog(tool, function);
} catch (IllegalArgumentException e) {
if (e.getMessage().contains("Sleigh language")) {
Msg.showWarn(this, null, "Cannot Emulate", e.getMessage());
} else throw e;
} Prevention
- Filter the Emulate Function action so it only appears for Sleigh-backed programs.
- Cache the language check when the program is loaded.
When it happens
Trigger: Invoking the 'Emulate Function' action/dialog on a Function whose Program was imported or synthesized with a Language that is not an instance of ghidra.app.plugin.processors.sleigh.SleighLanguage.
Common situations: Loading a program built on an obsolete/legacy processor module that predates Sleigh; using a hand-rolled or stub Language implementation in tests; opening emulation on a synthetic DomainObject whose language was set programmatically to a non-Sleigh subclass.
Related errors
- Emulation requires a Sleigh language
- Cannot emulate a trace unless it's opened in the tool.
- Cannot create register container
- TracePlatform must use a Sleigh language
- Trace must use a sleigh-based language
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/da3f8e2b0da6a06a.
Report an issue: GitHub.