NationalSecurityAgency/ghidra · error · IllegalArgumentException

Cannot parse tick step: '

Error message

Cannot parse tick step: '

What it means

TickStep.parse attempts to decode the stepSpec as a number using the given radix. Unlike SkipStep, there is no prefix to strip — the entire spec must be a valid number. If radix.decode throws NumberFormatException (e.g. the spec is not a valid integer), it is caught and re-thrown as IllegalArgumentException with the spec included for debugging.

Source

Thrown at Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/time/schedule/TickStep.java:33

 */
package ghidra.trace.model.time.schedule;

import ghidra.pcode.emu.PcodeThread;
import ghidra.trace.model.time.schedule.TraceSchedule.TimeRadix;
import ghidra.util.exception.CancelledException;
import ghidra.util.task.TaskMonitor;

/**
 * A step of a given thread in a schedule: repeating some number of ticks
 */
public class TickStep extends AbstractStep {

	public static TickStep parse(long threadKey, String stepSpec, TimeRadix radix) {
		try {
			return new TickStep(threadKey, radix.decode(stepSpec));
		}
		catch (NumberFormatException e) {
			throw new IllegalArgumentException("Cannot parse tick step: '" + stepSpec + "'");
		}
	}

	/**
	 * Construct a tick step for the given thread with the given tick count
	 * 
	 * @param threadKey the key of the thread in the trace, -1 for the "last thread"
	 * @param tickCount the number of ticks to step on the thread
	 */
	public TickStep(long threadKey, long tickCount) {
		super(threadKey, tickCount);
	}

	@Override
	public StepType getType() {
		return StepType.TICK;
	}

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Ensure the stepSpec is a valid integer string in the given radix
  2. If using hex counts, pass TimeRadix.HEX_UPPER or HEX_LOWER to the parent parse call
  3. For non-numeric patches, wrap in braces: '{sleigh}'
  4. For skip steps, prefix with 's'
  5. Validate: stepSpec.matches("^[0-9a-fA-F]+$") for hex, "^[0-9]+$" for decimal

Example fix

// before
TickStep.parse(1, "ff", TimeRadix.DEC); // 'ff' is not decimal
// after
TickStep.parse(1, "ff", TimeRadix.HEX_LOWER); // or use 255 with DEC
Defensive patterns

Strategy: validation

Validate before calling

boolean isValidTickSpec(String stepSpec, TimeRadix radix) {
    if (stepSpec == null || stepSpec.isEmpty()) return false;
    try {
        radix.decode(stepSpec);
        return true;
    } catch (NumberFormatException e) {
        return false;
    }
}

Type guard

// N/A

Try / catch

try {
    TickStep step = TickStep.parse(threadKey, stepSpec, radix);
} catch (IllegalArgumentException e) {
    // not a valid tick count; check radix or prompt user
}

Prevention

When it happens

Trigger: Calling TickStep.parse with a non-numeric spec like 'abc' or an empty string '', or a number in the wrong radix (hex digits with decimal radix). This is the fallback path in Step.parse — it is reached when the spec does not start with 's' or '{'.

Common situations: Passing a Sleigh fragment without braces that contains only text. Using hex numbers with decimal radix setting. Empty or whitespace-only step specs that bypass the earlier empty-string check in Step.parse (e.g. 't1-' splits to ['t1', '']). Locale-specific formatting issues.

Related errors


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