From f09b742321473bce0e0e005dd9bc23149d9ad62e Mon Sep 17 00:00:00 2001 From: ryzendigo <48058157+ryzendigo@users.noreply.github.com> Date: Mon, 16 Mar 2026 14:47:55 +0800 Subject: [PATCH] fix: unbound yuv_frame after FileNotFoundError in embeddings Both _process_updates() and _process_frame_updates() catch FileNotFoundError from frame_manager.get() but don't assign yuv_frame before the try block. If the exception fires, yuv_frame is never assigned and the subsequent 'if yuv_frame is None' check raises UnboundLocalError instead of gracefully returning. Initialize yuv_frame = None before each try block. --- frigate/embeddings/maintainer.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frigate/embeddings/maintainer.py b/frigate/embeddings/maintainer.py index 2c61c5fe9..46077375d 100644 --- a/frigate/embeddings/maintainer.py +++ b/frigate/embeddings/maintainer.py @@ -451,13 +451,13 @@ class EmbeddingMaintainer(threading.Thread): return # Create our own thumbnail based on the bounding box and the frame time + yuv_frame = None try: yuv_frame = self.frame_manager.get( frame_name, camera_config.frame_shape_yuv ) except FileNotFoundError: logger.debug(f"Frame {frame_name} not found for camera {camera}") - pass if yuv_frame is None: logger.debug( @@ -672,6 +672,7 @@ class EmbeddingMaintainer(threading.Thread): # no active features that use this data return + yuv_frame = None try: yuv_frame = self.frame_manager.get( frame_name, camera_config.frame_shape_yuv