NationalSecurityAgency/ghidra · error · IllegalArgumentException
Cannot parse step: '
Error message
Cannot parse step: '
What it means
Step.parse is the top-level dispatcher for a single step specification. It splits on '-', expecting either a single part (no thread prefix, defaults to -1/event thread) or two parts where the first starts with 't' followed by the thread key. If the split produces more than two parts, or two parts where the first does not start with 't', the spec is unparseable. This catches malformed step specs that don't match 'tickCount', 'tN-tickCount', 'sN', 'tN-sN', '{sleigh}', or 'tN-{sleigh}'.
Source
Thrown at Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/time/schedule/Step.java:62
* @param radix the radix
* @return the parsed step
* @throws IllegalArgumentException if the specification is of the wrong form
*/
static Step parse(String stepSpec, TimeRadix radix) {
if ("".equals(stepSpec)) {
return nop();
}
String[] parts = stepSpec.split("-");
if (parts.length == 1) {
return parse(-1, parts[0].trim(), radix);
}
if (parts.length == 2) {
String tPart = parts[0].trim();
if (tPart.startsWith("t")) {
return parse(Long.parseLong(tPart.substring(1)), parts[1].trim(), radix);
}
}
throw new IllegalArgumentException("Cannot parse step: '" + stepSpec + "'");
}
/**
* Parse a step for the given thread key
*
* <p>
* The form of the spec must either be numeric, indicating some number of ticks, or
* brace-enclosed Sleigh code, e.g., {@code "{r0=0x1234}"}. The latter allows patching machine
* state during execution.
*
* @param threadKey the thread to step, or -1 for the last thread or event thread
* @param stepSpec the string specification
* @param radix the radix
* @return the parsed step
* @throws IllegalArgumentException if the specification is of the wrong form
*/
static Step parse(long threadKey, String stepSpec, TimeRadix radix) {
if (stepSpec.startsWith("s")) {View on GitHub (pinned to d5f144c24d)
Solutions
- Ensure the spec matches one of: 'N', 'tN-M', 'sN', 'tN-sN', '{sleigh}', 'tN-{sleigh}'
- If using Sleigh with subtraction, ensure it is enclosed in braces: '{R0=R1-1}'
- Use Step.parse(threadKey, stepSpec, radix) directly when the thread key is already known, bypassing the split logic
- Validate the spec format before parsing with a regex like ^(t\d+-)?(s?\d+|\{.*\})$
Example fix
// before
Step.parse("1-2", radix); // ambiguous: no 't' prefix
// after
Step.parse("t1-2", radix); Defensive patterns
Strategy: validation
Validate before calling
boolean isValidStepSpec(String stepSpec) {
// Form: N | tN-M | sN | tN-sN | {sleigh} | tN-{sleigh}
return stepSpec != null
&& stepSpec.matches("^(t\\d+-)?(s?\\d+|\\{.*})$");
} Type guard
// N/A
Try / catch
try {
Step step = Step.parse(stepSpec, radix);
} catch (IllegalArgumentException e) {
// log the malformed spec and report to user
} Prevention
- Ensure Sleigh code with '-' is always brace-enclosed
- Follow the documented grammar: [t<key>-]<tick|skip|patch>
- Use Step.parse(threadKey, stepSpec, radix) when key is known to bypass the split
When it happens
Trigger: Passing a stepSpec with multiple dashes like 't1-2-3', or a two-part split where the first part doesn't start with 't' like '1-2'. Also when a Sleigh patch contains a dash character outside braces, causing an unexpected split.
Common situations: Sleigh code containing '-' (subtraction operator) in a patch step that is not brace-enclosed or where braces are malformed. Building step specs by string concatenation with incorrect separators. Schedule strings with corrupted or truncated step segments.
Related errors
- Cannot parse step: '
- Cannot parse skip step: '
- Cannot step a negative number
- Cannot advance a negative number
- Total step count exceeds LONG_MAX
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/2ec323a70a7b2d61.
Report an issue: GitHub.