Husky: Error: Can't change glitch settings if not enabled and locked

Sometimes an error appears “Can’t change glitch settings if not enabled and locked.”
prog.scope.adc.samples = 100000
prog.scope.adc.offset = 0
prog.scope.clock.clkgen_src = “system”
prog.scope.clock.clkgen_freq = 96E6
prog.scope.clock.adc_mul = 2
prog.scope.glitch.enabled = True
prog.scope.glitch.clk_src = “pll” # set glitch input clock
prog.scope.clock.pll.update_fpga_vco(1200e6)
prog.scope.glitch.output = “glitch_only” # glitch_out = clk ^ glitch
prog.scope.glitch.trigger_src = “ext_single” # glitch only after scope.arm() called
prog.scope.trigger.sequencer_enabled = True
prog.scope.trigger.num_triggers = 2
prog.scope.adc.basic_mode = “rising_edge”
prog.scope.trigger.module[0] = ‘UART’
prog.scope.trigger.triggers[0] = ‘tio2’
prog.scope.trigger.module[1] = ‘SAD’
starting_sample = 0
l2trace = np.load(‘ACK.npy’)
prog.scope.SAD.reference = l2trace[1200:1700]
prog.scope.UARTTrigger.set_pattern_match(0, ‘\x13’) # match … that we send
prog.scope.UARTTrigger.trigger_source = 0
prog.scope.SAD.threshold = 1000
prog.scope.adc.presamples = starting_sample + scope.SAD.sad_reference_length + scope.SAD.latency
prog.scope.UARTTrigger.enabled = True
prog.scope.UARTTrigger.baud = 115200
prog.scope.UARTTrigger.parity = “even”
prog.scope.UARTTrigger.stop_bits = 1
prog.scope.gain.db = 22
prog.scope.UARTTrigger.accept_parity_errors = True
prog.scope.UARTTrigger.rules_enabled = [0]
prog.scope.trigger.window_start = starting_sample + scope.SAD.sad_reference_length + scope.SAD.latency
prog.scope.trigger.window_end = 0 #7000
prog.scope.io.glitch_trig_mcx = ‘trigger’
assert prog.scope.glitch.mmcm_locked

Then an error occurs here:
prog.scope.glitch.offset = glitch_setting[1]
prog.scope.glitch.width = glitch_setting[0]
prog.scope.glitch.ext_offset = glitch_setting[2]

What are the values of glitch_setting?
What is the output of print(prog.scope.glitch) after the error occurs?

sequence trigger #0 =
module = UART
triggers = tio2
sequence trigger #1 =
module = SAD
window_start = 204
window_end = 0

scope.glitch.phase_shift_steps= 672

gc.set_range(“width”, 250, 255)
gc.set_range(“offset”, -120, -140)
gc.set_range(“ext_offset”, 1, 40)

You didn’t answer either of my questions.
Can you give me:

  1. A minimal reproducible example which leads to the “Can’t change glitch settings if not enabled and locked” error.
  2. The output of print(scope) after the error occurs.