VOD event endpoint returns 404 when requested immediately after event creation (race condition) #22256
-
Checklist
Describe the problem you are havingThe VOD event endpoint When Frigate creates a new event (e.g., person detected), it publishes the event via MQTT immediately. However, the recording segments for that event are not yet committed/indexed at that point. Any client requesting the VOD endpoint during this window receives a 404 error. This is particularly problematic for Home Assistant notification blueprints (e.g., SgtBatten/HA-blueprints Stable.yaml) that generate push notifications with video preview URLs immediately upon receiving the MQTT event. The notification links to Expected behavior: The VOD endpoint should either wait for segments to become available (with a reasonable timeout), return a proper 'pending' status, or the event creation should be deferred until at least one segment is committed. Actual behavior: The endpoint returns 404, and the video never becomes available through the notification link (users must manually navigate to the Frigate UI to view the recording). Steps to reproduce
The race condition window appears to be approximately 5-10 seconds after event creation. Version0.17.0-f0d69f7 In which browser(s) are you experiencing the issue with?N/A - This is a backend API issue, not browser-specific Frigate config fileversion: 0.17-0
mqtt:
host: 10.10.10.10
port: 1883
detectors:
coral:
type: edgetpu
device: usb
cpu_fallback:
type: cpu
num_threads: 4
go2rtc:
streams:
eingang:
- rtsp://admin:password@10.10.10.156:554/Streaming/Channels/101
cameras:
eingang:
ffmpeg:
inputs:
- path: rtsp://127.0.0.1:8554/eingang
roles: [detect, record]
detect:
width: 2688
height: 1520
fps: 10
objects:
track: [person, dog]
recording:
enabled: true
retain:
days: 14
mode: motion
events:
retain:
default: 30
mode: active_objectsdocker-compose file or Docker CLI commandDocker run on Unraid (via Community Applications template):
docker run -d --name='frigate' \
--privileged \
-e TZ="Europe/Berlin" \
-p 5000:5000 -p 8554:8554 -p 8555:8555/tcp -p 8555:8555/udp \
-v /mnt/cache/appdata/frigate:/config \
-v /mnt/poolboy/frigate:/media/frigate \
--device /dev/bus/usb:/dev/bus/usb \
--mount type=tmpfs,target=/tmp/cache,tmpfs-size=1000000000 \
--shm-size=256m \
ghcr.io/blakeblackshear/frigate:0.17.0Relevant Frigate log outputNo specific error logs - the issue is a timing/race condition, not a crash.
When requesting /vod/event/{id}/master.m3u8 within ~5-10 seconds of event creation,
the endpoint returns HTTP 404 silently. No error is logged on the Frigate side because
the recording segments simply haven't been committed to the database yet.
After the segments are committed (typically 10+ seconds after event creation),
the same endpoint returns 200 OK with valid HLS playlist data.Relevant go2rtc log outputN/A - go2rtc is functioning correctly. The issue is in the VOD/recording segment indexing pipeline, not in the streaming layer.Operating systemUNRAID Install methodDocker CLI Network connectionWired Camera make and modelHiKVision DS-2CD2346G2-IU Screenshots of the Frigate UI's System metrics pagesN/A - Backend API issue, not a UI rendering problem. Any other information that may be helpfulThis issue particularly impacts the Home Assistant notification ecosystem. The SgtBatten/HA-blueprints Stable.yaml blueprint (widely used) generates push notifications with video URLs immediately upon MQTT event receipt. Since the MQTT event fires before recording segments are committed, the video URL is always broken when tapped. Additionally, the event thumbnail/preview images also intermittently return HTTP 404 and HTTP 454 status errors, likely caused by the same race condition where the recording segments and associated media files are not yet available when requested immediately after event creation. Environment: Unraid 7.0.0, Frigate 0.17.0 Docker, Coral USB Edge TPU on USB 3.0, HiKVision camera via go2rtc RTSP restream. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
|
You've identified a timing issue where the The VOD event endpoint returns an HLS playlist for the specified event(1)(2). According to the API documentation, you append The race condition you're experiencing occurs because Frigate publishes MQTT events immediately when objects are tracked, but the recording segments may not yet be available. The Workaround approach: Monitor the "has_clip": falseThis field updates to Alternative consideration: The The documentation doesn't specify a built-in delay or retry mechanism for the VOD endpoint when segments aren't yet available. Your observation about the 5-10 second window aligns with typical segment duration and commit intervals in video recording systems. For immediate notification use cases, you may need to implement client-side retry logic or delay notification generation until the 📚 Sources: Have another question? Just tag @inkeep. |
Beta Was this translation helpful? Give feedback.
-
|
The AI is correct, this is expected behavior and not a bug. Frigate reports tracked object events using the stream defined by the |
Beta Was this translation helpful? Give feedback.
-
|
Since you're using the sgtbatten blueprint, the recommendation is to base notifications on the |
Beta Was this translation helpful? Give feedback.
Since you're using the sgtbatten blueprint, the recommendation is to base notifications on the
reviewstopic, rather thanevents. If you want to continue to useevents, thehas_clipproperty is the correct one you'll want to filter on.