NationalSecurityAgency/ghidra · error · IllegalArgumentException
TracePlatform must use a Sleigh language
Error message
TracePlatform must use a Sleigh language
What it means
buildByteExecutor constructs a byte-array p-code executor over a trace platform by compiling/using Sleigh-specific machinery. It requires platform.getLanguage() to be a SleighLanguage; any other Language implementation is rejected because Sleigh expression compilation and the bytes arithmetic depend on it.
Source
Thrown at Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/pcode/exec/trace/TraceSleighUtils.java:62
/**
* Build a p-code executor that operates directly on bytes of the given trace
*
* <p>
* This executor is most suitable for evaluating Sleigh expression on a given trace snapshot,
* and for manipulating or initializing variables using Sleigh code. It is generally not
* suitable for use in an emulator. For that, use {@link PcodeEmulator} with
* {@link TraceEmulationIntegration}.
*
* @param platform the platform
* @param snap the snap
* @param thread the thread, required if register space is used
* @param frame the frame, for when register space is used
* @return the executor
*/
public static PcodeExecutor<byte[]> buildByteExecutor(TracePlatform platform, long snap,
TraceThread thread, int frame) {
if (!(platform.getLanguage() instanceof SleighLanguage language)) {
throw new IllegalArgumentException("TracePlatform must use a Sleigh language");
}
DefaultPcodeTraceAccess access = new DefaultPcodeTraceAccess(platform, snap);
PcodeStateCallbacks cb =
TraceEmulationIntegration.bytesImmediateWrite(access, thread, frame);
BytesPcodeExecutorState state = new BytesPcodeExecutorState(language, cb);
return new PcodeExecutor<>(language, BytesPcodeArithmetic.forLanguage(language), state,
Reason.INSPECT);
}
/**
* @see #buildByteExecutor(TracePlatform, long, TraceThread, int)
* @param trace the trace whose host platform to use
* @param snap the snap
* @param thread the thread, required if register space is used
* @param frame the frame, for when register space is used
* @return the executor
*/
public static PcodeExecutor<byte[]> buildByteExecutor(Trace trace, long snap,View on GitHub (pinned to d5f144c24d)
Solutions
- Verify platform.getLanguage() instanceof SleighLanguage before calling buildByteExecutor; if not, use the host platform or a Sleigh-backed guest.
- Ensure the trace's language provider resolves to a SleighLanguage (proper language ID / .ldefs entry).
- If you must evaluate on a non-Sleigh language, implement the byte arithmetic/executor yourself instead of using this helper.
Example fix
// before
PcodeExecutor<byte[]> exec = TraceSleighUtils.buildByteExecutor(platform, snap, thread, frame);
// after
if (!(platform.getLanguage() instanceof SleighLanguage)) {
throw new IllegalStateException("platform not Sleigh-based: " + platform.getLanguage());
}
PcodeExecutor<byte[]> exec = TraceSleighUtils.buildByteExecutor(platform, snap, thread, frame); Defensive patterns
Strategy: type-guard
Validate before calling
if (!(platform.getLanguage() instanceof SleighLanguage)) {
throw new IllegalStateException(
"platform language is not Sleigh: " + platform.getLanguage());
}
PcodeExecutor<byte[]> exec = TraceSleighUtils.buildByteExecutor(platform, snap, thread, frame); Type guard
static boolean isSleighPlatform(TracePlatform platform) {
return platform.getLanguage() instanceof SleighLanguage;
} Try / catch
try {
PcodeExecutor<byte[]> exec = TraceSleighUtils.buildByteExecutor(platform, snap, thread, frame);
} catch (IllegalArgumentException e) {
if (e.getMessage().contains("Sleigh language")) {
// switch to a Sleigh-backed platform or host platform
} else throw e;
} Prevention
- Always create guest platforms from a Sleigh language provider.
- When loading a trace, assert its host language is Sleigh before invoking Sleigh helpers.
- Cache the Sleigh check result per platform to avoid repeated instanceof checks.
When it happens
Trigger: Calling TraceSleighUtils.buildByteExecutor(platform, snap, thread, frame) where platform is a guest platform whose language is not a SleighLanguage subclass (a custom or non-Sleigh Language).
Common situations: Defining a guest platform backed by a hand-rolled Language. Loading a trace whose base language provider returned a non-Sleigh language. Mixed-language traces where a guest language lacks a Sleigh implementation.
Related errors
- Sleigh language required
- Emulation requires a Sleigh language
- Trace must use a sleigh-based language
- Current trace does not use Sleigh
- Unknown register or label: '{nm}'
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/b61dc983076a5a63.
Report an issue: GitHub.