{"record":{"id":"1ba1a965ea6a1fed","repo":"NationalSecurityAgency/ghidra","slug":"cannot-parse-tick-step","errorCode":null,"errorMessage":"Cannot parse tick step: '","messagePattern":"Cannot parse tick step: '","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/time/schedule/TickStep.java","lineNumber":33,"sourceCode":" */\npackage ghidra.trace.model.time.schedule;\n\nimport ghidra.pcode.emu.PcodeThread;\nimport ghidra.trace.model.time.schedule.TraceSchedule.TimeRadix;\nimport ghidra.util.exception.CancelledException;\nimport ghidra.util.task.TaskMonitor;\n\n/**\n * A step of a given thread in a schedule: repeating some number of ticks\n */\npublic class TickStep extends AbstractStep {\n\n\tpublic static TickStep parse(long threadKey, String stepSpec, TimeRadix radix) {\n\t\ttry {\n\t\t\treturn new TickStep(threadKey, radix.decode(stepSpec));\n\t\t}\n\t\tcatch (NumberFormatException e) {\n\t\t\tthrow new IllegalArgumentException(\"Cannot parse tick step: '\" + stepSpec + \"'\");\n\t\t}\n\t}\n\n\t/**\n\t * Construct a tick step for the given thread with the given tick count\n\t * \n\t * @param threadKey the key of the thread in the trace, -1 for the \"last thread\"\n\t * @param tickCount the number of ticks to step on the thread\n\t */\n\tpublic TickStep(long threadKey, long tickCount) {\n\t\tsuper(threadKey, tickCount);\n\t}\n\n\t@Override\n\tpublic StepType getType() {\n\t\treturn StepType.TICK;\n\t}\n","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/time/schedule/TickStep.java#L15-L51","documentation":"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.","triggerScenarios":"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 '{'.","commonSituations":"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.","solutions":["Ensure the stepSpec is a valid integer string in the given radix","If using hex counts, pass TimeRadix.HEX_UPPER or HEX_LOWER to the parent parse call","For non-numeric patches, wrap in braces: '{sleigh}'","For skip steps, prefix with 's'","Validate: stepSpec.matches(\"^[0-9a-fA-F]+$\") for hex, \"^[0-9]+$\" for decimal"],"exampleFix":"// before\nTickStep.parse(1, \"ff\", TimeRadix.DEC); // 'ff' is not decimal\n// after\nTickStep.parse(1, \"ff\", TimeRadix.HEX_LOWER); // or use 255 with DEC","handlingStrategy":"validation","validationCode":"boolean isValidTickSpec(String stepSpec, TimeRadix radix) {\n    if (stepSpec == null || stepSpec.isEmpty()) return false;\n    try {\n        radix.decode(stepSpec);\n        return true;\n    } catch (NumberFormatException e) {\n        return false;\n    }\n}","typeGuard":"// N/A","tryCatchPattern":"try {\n    TickStep step = TickStep.parse(threadKey, stepSpec, radix);\n} catch (IllegalArgumentException e) {\n    // not a valid tick count; check radix or prompt user\n}","preventionTips":["Match radix to number format — hex digits require hex radix","Avoid empty strings as tick specs","Use new TickStep(threadKey, tickCount) when you have a numeric value"],"tags":["ghidra","trace-schedule","tick-step","number-format"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}