{"record":{"id":"dced98d9f7512ff9","repo":"roboflow/supervision","slug":"invalid-metric-target-self-metric-target-dced98","errorCode":null,"errorMessage":"Invalid metric target: {self._metric_target}","messagePattern":"Invalid metric target: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/supervision/metrics/recall.py","lineNumber":565,"sourceCode":"        if self._metric_target == MetricTarget.BOXES:\n            return cast(npt.NDArray[Any], detections.xyxy)\n        if self._metric_target == MetricTarget.MASKS:\n            if detections.mask is not None:\n                # detections.mask is NDArray[bool] | CompactMask; return as-is.\n                return detections.mask\n            if len(detections) > 0:\n                raise ValueError(\n                    \"Recall with `MetricTarget.MASKS` requires detections to \"\n                    \"include masks.\"\n                )\n            return self._make_empty_content()\n        if self._metric_target == MetricTarget.ORIENTED_BOUNDING_BOXES:\n            obb = detections.data.get(ORIENTED_BOX_COORDINATES)\n            if obb is not None and len(obb) > 0:\n                result_obb: npt.NDArray[np.float32] = np.array(obb, dtype=np.float32)\n                return result_obb\n            return self._make_empty_content()\n        raise ValueError(f\"Invalid metric target: {self._metric_target}\")\n\n    def _make_empty_content(self) -> npt.NDArray[Any]:\n        if self._metric_target == MetricTarget.BOXES:\n            empty_boxes: npt.NDArray[np.float32] = np.empty((0, 4), dtype=np.float32)\n            return empty_boxes\n\n        if self._metric_target == MetricTarget.MASKS:\n            empty_masks: npt.NDArray[np.bool_] = np.empty((0, 0, 0), dtype=bool)\n            return empty_masks\n\n        if self._metric_target == MetricTarget.ORIENTED_BOUNDING_BOXES:\n            empty_obb: npt.NDArray[np.float32] = np.empty((0, 4, 2), dtype=np.float32)\n            return empty_obb\n\n        raise ValueError(f\"Invalid metric target: {self._metric_target}\")\n\n        raise ValueError(f\"Invalid metric target: {self._metric_target}\")\n","sourceCodeStart":547,"sourceCodeEnd":583,"githubUrl":"https://github.com/roboflow/supervision/blob/7f254d9784d4c37e0f03cd89ddee164c8db099c0/src/supervision/metrics/recall.py#L547-L583","documentation":"Error \"Invalid metric target: {self._metric_target}\" thrown in roboflow/supervision.","triggerScenarios":"Thrown at src/supervision/metrics/recall.py:565 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Construct the metric with a valid MetricTarget value (BOXES, MASKS, or ORIENTED_BOUNDING_BOXES as supported).","Do not mutate the internal metric target; set it only via the constructor."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7f254d9784d4c37e0f03cd89ddee164c8db099c0","analyzedAt":"2026-08-15T05:13:01.950Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}