roboflow/supervision · error · ValueError

Cannot pass both 'confidence' and 'keypoint_confidence'. 'co

Error message

Cannot pass both 'confidence' and 'keypoint_confidence'. 'confidence' is deprecated — use 'keypoint_confidence' only.

What it means

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.

Source

Thrown at src/supervision/key_points/core.py:276

            keypoint_confidence: Array of shape `(n, m)` with per-keypoint
                confidence scores. Defaults to None.
            detection_confidence: Array of shape `(n,)` with detection-level
                confidence scores. Defaults to None.
            visible: Boolean array of shape `(n, m)` indicating visible
                keypoints. Defaults to None.
            data: Dictionary of additional per-detection data arrays.
                Defaults to an empty dict.
            confidence: Deprecated since `0.29.0`, removed in `0.32.0`.
                Use ``keypoint_confidence`` instead. Raises ``ValueError``
                if passed together with ``keypoint_confidence``.

        Raises:
            ValueError: If both ``confidence`` and ``keypoint_confidence``
                are provided.
        """
        if confidence is not None:
            if keypoint_confidence is not None:
                raise ValueError(
                    "Cannot pass both 'confidence' and 'keypoint_confidence'. "
                    "'confidence' is deprecated — use 'keypoint_confidence' only."
                )
            warn_deprecated(
                "'confidence' parameter in `KeyPoints()` is deprecated since "
                "`0.29.0` and will be removed in `0.32.0`. Use "
                "'keypoint_confidence' instead."
            )
            keypoint_confidence = confidence

        self.xy = xy
        self.class_id = class_id
        self.keypoint_confidence = keypoint_confidence
        self.detection_confidence = detection_confidence
        self.visible = visible
        self.data = data if data is not None else {}
        self.__post_init__()

View on GitHub (pinned to 7f254d9784)

Solutions

  1. Delete the confidence= keyword and keep only keypoint_confidence=.
  2. Grep the codebase for 'confidence=' in KeyPoints(...) calls to catch every remaining deprecated usage before 0.32.0 removes it.

Example fix

// before
kp = sv.KeyPoints(xy=xy, confidence=conf, keypoint_confidence=conf)

// after
kp = sv.KeyPoints(xy=xy, keypoint_confidence=conf)
Defensive patterns

Strategy: validation

Prevention

When it happens

Trigger: Calling sv.KeyPoints(xy=..., confidence=conf, keypoint_confidence=conf) — typically when migrating old code by adding the new parameter without removing the old one.

Common situations: 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.

Related errors


AI-assisted analysis of roboflow/supervision@7f254d9784 (2026-08-15). Data as JSON: /api/errors/19b6982a2e2e414c. Report an issue: GitHub.