NationalSecurityAgency/ghidra · error · IllegalStateException

Current trace does not use Sleigh

Error message

Current trace does not use Sleigh

What it means

Ghidra DebuggerGoToTrait.goToSleigh() requires the current trace's language to be a SleighLanguage. If platform.getLanguage() is not a SleighLanguage, an IllegalStateException is thrown because Pcode/Sleigh expression evaluation is unavailable for that language type.

Source

Thrown at Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/action/DebuggerGoToTrait.java:159

	 * @return the result
	 */
	public CompletableFuture<GoToResult> goTo(String spaceName, String offset, LitIdMode mode) {
		TracePlatform platform = current.getPlatform();
		offset = adjustOffset(offset);

		Address address = tryAddress(platform.getAddressFactory(), spaceName, offset);
		if (address != null) {
			return CompletableFuture
					.completedFuture(new GoToResult(address, goToAddress(address)));
		}
		return goToSleigh(spaceName, offset, mode);
	}

	protected CompletableFuture<GoToResult> goToSleigh(String spaceName, String expression,
			LitIdMode mode) {
		TracePlatform platform = current.getPlatform();
		if (!(platform.getLanguage() instanceof SleighLanguage)) {
			throw new IllegalStateException("Current trace does not use Sleigh");
		}
		AddressSpace space = platform.getAddressFactory().getAddressSpace(spaceName);
		if (space == null) {
			throw new IllegalArgumentException("No such address space: " + spaceName);
		}
		PcodeExpression expr = DebuggerPcodeUtils.compileExpression(tool, current,
			getCurrentAddress(), expression, mode);
		return goToSleigh(platform, space, expr);
	}

	protected CompletableFuture<GoToResult> goToSleigh(TracePlatform platform, AddressSpace space,
			PcodeExpression expression) {
		PcodeExecutor<byte[]> executor = DebuggerPcodeUtils.executorForCoordinates(tool, current);
		CompletableFuture<byte[]> result =
			CompletableFuture.supplyAsync(() -> expression.evaluate(executor));
		return result.thenApplyAsync(offset -> {
			Address address = space.getAddress(
				Utils.bytesToLong(offset, offset.length, expression.getLanguage().isBigEndian()));

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Use a trace backed by a Sleigh language (Ghidra's standard processor definitions are Sleigh-based).
  2. Provide a literal address/space+offset instead of a Sleigh expression so the plain-address path resolves.
  3. Verify `platform.getLanguage() instanceof SleighLanguage` before enabling expression-based Go-To.
  4. Catch IllegalStateException and degrade to address-only navigation.

Example fix

// before
// trace loaded with a non-Sleigh language; user enters a pcode expression
future = goToSleigh(space, "inst_start + 5", mode); // throws

// after
if (platform.getLanguage() instanceof SleighLanguage) {
    future = goToSleigh(space, "inst_start + 5", mode);
} else {
    future = goToAddress(plainOffset); // address-only fallback
}
Defensive patterns

Strategy: type-guard

Validate before calling

if (!(platform.getLanguage() instanceof SleighLanguage)) {
    // disable Sleigh expression Go-To; offer address-only navigation
    return;
}

Type guard

boolean isSleighTrace(TracePlatform p) {
    return p.getLanguage() instanceof SleighLanguage;
}

Try / catch

try {
    goToSleigh(space, expr, mode);
} catch (IllegalStateException ex) {
    // 'Current trace does not use Sleigh'; fall back to plain address
}

Prevention

When it happens

Trigger: Issuing a Go-To that resolves to a Sleigh/Pcode expression (the plain-address path returned null) while the active trace uses a non-Sleigh language.

Common situations: Loading or attaching to a program whose processor language is not Sleigh-based; a custom/legacy language module; switching traces to one without Sleigh support mid-session.

Related errors


AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14). Data as JSON: /api/errors/99db1d49b8d18479. Report an issue: GitHub.