Weird bug in sample playback?

Okay, this is a weird one. I’m getting intermittent problems with the sample command.
When I run these commands:

use_sample_bpm :ambi_drone
sample :ambi_drone
sleep 2

sample :ambi_drone, pitch_stretch: 1.4983070768766815 * 8, rpitch: 7, time_dis: 0.01, window_size: 0.1, pitch_dis: 0.01, num_slices: 16, slice: 2

I get this error:
Runtime Error: [buffer 2, line 6] - Thread death!
Value of opt :pitch must be a value less than or equal to 24, got 43.0. (RuntimeError)

It seems to be related to the pitch_stretch param – when it stretches too long, it seems to affect the rpitch under the hood.
How do I avoid this? I’m working on a general-purpose routine to pitch-shift samples (among other things), and sometimes (but not consistently) a similar error gets thrown.
Are there guidelines I need to follow to keep hitting these situations?
Thanks!

I’m not sure, but I played around with it a bit, and it seems to me that sample only supports pitch_stretch values of 4.0 or less (but maybe it also depends on the values of other parameters).
It’s a bit confusing because the error message refers to the pitch, which wasn’t specified, but that seems to directly depend on the value of pitch_stretch (something like pitch = 12 * log2(pitch_stretch), i.e. it’s converting a ratio to a MIDI offset).