{"record":{"id":"19b6982a2e2e414c","repo":"roboflow/supervision","slug":"cannot-pass-both-confidence-and-keypoint-confid","errorCode":null,"errorMessage":"Cannot pass both 'confidence' and 'keypoint_confidence'. 'confidence' is deprecated — use 'keypoint_confidence' only.","messagePattern":"Cannot pass both 'confidence' and 'keypoint_confidence'\\. 'confidence' is deprecated — use 'keypoint_confidence' only\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/supervision/key_points/core.py","lineNumber":276,"sourceCode":"            keypoint_confidence: Array of shape `(n, m)` with per-keypoint\n                confidence scores. Defaults to None.\n            detection_confidence: Array of shape `(n,)` with detection-level\n                confidence scores. Defaults to None.\n            visible: Boolean array of shape `(n, m)` indicating visible\n                keypoints. Defaults to None.\n            data: Dictionary of additional per-detection data arrays.\n                Defaults to an empty dict.\n            confidence: Deprecated since `0.29.0`, removed in `0.32.0`.\n                Use ``keypoint_confidence`` instead. Raises ``ValueError``\n                if passed together with ``keypoint_confidence``.\n\n        Raises:\n            ValueError: If both ``confidence`` and ``keypoint_confidence``\n                are provided.\n        \"\"\"\n        if confidence is not None:\n            if keypoint_confidence is not None:\n                raise ValueError(\n                    \"Cannot pass both 'confidence' and 'keypoint_confidence'. \"\n                    \"'confidence' is deprecated — use 'keypoint_confidence' only.\"\n                )\n            warn_deprecated(\n                \"'confidence' parameter in `KeyPoints()` is deprecated since \"\n                \"`0.29.0` and will be removed in `0.32.0`. Use \"\n                \"'keypoint_confidence' instead.\"\n            )\n            keypoint_confidence = confidence\n\n        self.xy = xy\n        self.class_id = class_id\n        self.keypoint_confidence = keypoint_confidence\n        self.detection_confidence = detection_confidence\n        self.visible = visible\n        self.data = data if data is not None else {}\n        self.__post_init__()\n","sourceCodeStart":258,"sourceCodeEnd":294,"githubUrl":"https://github.com/roboflow/supervision/blob/7f254d9784d4c37e0f03cd89ddee164c8db099c0/src/supervision/key_points/core.py#L258-L294","documentation":"Raised by the KeyPoints constructor when both the deprecated confidence parameter and its replacement keypoint_confidence are passed. Since 0.29.0 confidence is deprecated (removal in 0.32.0); passing both is ambiguous, so the constructor rejects the call instead of guessing which value wins.","triggerScenarios":"Calling sv.KeyPoints(xy=..., confidence=conf, keypoint_confidence=conf) — typically when migrating old code by adding the new parameter without removing the old one.","commonSituations":"Upgrading a supervision app from <0.29.0 to >=0.29.0: an old call with confidence= gets copy-pasted next to a new keypoint_confidence=; IDE auto-complete or partial migration adds the new name while the old keyword remains.","solutions":["Delete the confidence= keyword and keep only keypoint_confidence=.","Grep the codebase for 'confidence=' in KeyPoints(...) calls to catch every remaining deprecated usage before 0.32.0 removes it."],"exampleFix":"// before\nkp = sv.KeyPoints(xy=xy, confidence=conf, keypoint_confidence=conf)\n\n// after\nkp = sv.KeyPoints(xy=xy, keypoint_confidence=conf)","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Migrate all KeyPoints(confidence=...) calls to keypoint_confidence= now; confidence is removed in 0.32.0.","Never pass both names — the constructor treats it as a hard error, not a warning.","Grep for `confidence=` near KeyPoints after every supervision upgrade."],"tags":["keypoints","deprecation","api-migration","validation"],"backgroundTag":null,"analyzedSha":"7f254d9784d4c37e0f03cd89ddee164c8db099c0","analyzedAt":"2026-08-15T05:13:01.950Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}