From d12ad2691cfda5c375bd22bc9a1803ff1460c65b Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 10 May 2026 19:45:51 +0000 Subject: [PATCH] log(masks): include camera name in invalid-coordinates error get_relative_coordinates() previously logged "Not applying mask due to invalid coordinates. X,Y is outside ..." without naming the camera, so on a multi-camera setup the user had to guess which one to fix. Add an optional camera_name kwarg with default "" (no behavior change for existing callers). The global object-mask path in FrigateConfig.validate_config passes camera_name=camera_config.name since it already has it in scope, so legacy configs with absolute pixel coordinates now get an actionable log line: Not applying mask due to invalid coordinates for camera back. 9000,9000 is outside of the detection resolution 800x400. Use the editor in the UI to correct the mask. Existing wording is preserved verbatim except for the inserted " for camera " segment. Runtime behavior is unchanged. --- frigate/config/config.py | 4 +++- frigate/util/config.py | 9 ++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/frigate/config/config.py b/frigate/config/config.py index 751de16202..d1cc2101be 100644 --- a/frigate/config/config.py +++ b/frigate/config/config.py @@ -862,7 +862,9 @@ class FrigateConfig(FrigateBaseModel): if mask_config: coords = mask_config.coordinates relative_coords = get_relative_coordinates( - coords, camera_config.frame_shape + coords, + camera_config.frame_shape, + camera_name=camera_config.name, ) # Create a new ObjectMaskConfig with raw_coordinates set processed_global_masks[mask_id] = ObjectMaskConfig( diff --git a/frigate/util/config.py b/frigate/util/config.py index 578ec18527..60d440339a 100644 --- a/frigate/util/config.py +++ b/frigate/util/config.py @@ -608,11 +608,14 @@ def migrate_018_0(config: dict[str, dict[str, Any]]) -> dict[str, dict[str, Any] def get_relative_coordinates( - mask: Optional[Union[str, list]], frame_shape: tuple[int, int] + mask: Optional[Union[str, list]], + frame_shape: tuple[int, int], + camera_name: str = "", ) -> Union[str, list]: # masks and zones are saved as relative coordinates # we know if any points are > 1 then it is using the # old native resolution coordinates + where = f" for camera {camera_name}" if camera_name else "" if mask: if isinstance(mask, list) and any(x > "1.0" for x in mask[0].split(",")): relative_masks = [] @@ -627,7 +630,7 @@ def get_relative_coordinates( if x > frame_shape[1] or y > frame_shape[0]: logger.error( - f"Not applying mask due to invalid coordinates. {x},{y} is outside of the detection resolution {frame_shape[1]}x{frame_shape[0]}. Use the editor in the UI to correct the mask." + f"Not applying mask due to invalid coordinates{where}. {x},{y} is outside of the detection resolution {frame_shape[1]}x{frame_shape[0]}. Use the editor in the UI to correct the mask." ) continue @@ -650,7 +653,7 @@ def get_relative_coordinates( if x > frame_shape[1] or y > frame_shape[0]: logger.error( - f"Not applying mask due to invalid coordinates. {x},{y} is outside of the detection resolution {frame_shape[1]}x{frame_shape[0]}. Use the editor in the UI to correct the mask." + f"Not applying mask due to invalid coordinates{where}. {x},{y} is outside of the detection resolution {frame_shape[1]}x{frame_shape[0]}. Use the editor in the UI to correct the mask." ) return []