Mac M2 Pro, Export fails when "use hardware encoder" is enabled

Shotcut 25.01.25
Macbook Pro M2
Preset used = YouTube
Use Hardware Encoder is checked.

Export fails.
Log:
[h264 @ 0x114776110] Reinit context to 1920x1088, pix_fmt: yuv420p
[h264 @ 0x114776fd0] Reinit context to 1920x1088, pix_fmt: yuv420p
[h264 @ 0x114784f40] Reinit context to 1920x1088, pix_fmt: yuv420p
[producer avformat] audio: total_streams 1 max_stream 1 total_channels 2 max_channels 2
[AVIOContext @ 0x114772720] Statistics: 1784974 bytes read, 2 seeks
[chain avformat-novalidate] /Users/XYZ/XYZ.mp4
checking VFR: pkt.duration 512
[h264 @ 0x114775ce0] Reinit context to 1920x1088, pix_fmt: yuv420p
[h264_videotoolbox @ 0x135217340] Color range not set for nv12. Using MPEG range.
[mp4 @ 0x135216d60] pts (512) < dts (1024) in stream 0
[consumer avformat] error writing video frame: -22
[mp4 @ 0x135216d60] Starting second pass: moving the moov atom to the beginning of the file
[AVIOContext @ 0x1147ee850] Statistics: 89646 bytes read, 0 seeks
[aac @ 0x135217b50] Qavg: 65536.000
[aac @ 0x135217b50] 2 frames left in the queue on closing
[AVIOContext @ 0x11476bd60] Statistics: 180776 bytes written, 4 seeks, 5 writeouts

[AVIOContext @ 0x1147848a0] Statistics: 1883278 bytes read, 2 seeks
[AVIOContext @ 0x114775a60] Statistics: 2126629 bytes read, 3 seeks
Failed with exit code 1

Did you try to play the file even though the job failed? It appears to have possibly created a valid despite the failure (false negative)? Otherwise, I do not reproduce it on my M1 Mac. If you are only doing H.264 output you do not really need to use hardware encoder on a modern powerful machine (little to no benefit).

When the job fails the file is also aborted.
But, it is OK, all works fine without the hardware encoder.
Thanks.

How do you know? Your log seems to indicate to me otherwise.

When the job failed in UI, I kept the UI open for like 15 minutes. The video export normally takes 2-3 mins. The exported file only had like 1 frame in it.