The tracer uses the example inputs you provide and records the operations. If a different input would result in a different operation, then this will not be captured by the tracer. Here it’s recording the arguments to the slice operation as constants (so it will always slice it with the values produced with the example inputs).
To get around this, put any code with data-dependent control flow inside a ScriptModule 251, and then call that in your traced code.