{"record":{"id":"57e9864b43253325","repo":"roboflow/supervision","slug":"unsupported-mediapipe-result-type-expected-an-obj","errorCode":null,"errorMessage":"Unsupported MediaPipe result type. Expected an object with pose_landmarks, face_landmarks, or multi_face_landmarks.","messagePattern":"Unsupported MediaPipe result type\\. Expected an object with pose_landmarks, face_landmarks, or multi_face_landmarks\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/supervision/key_points/core.py","lineNumber":569,"sourceCode":"                    results = [\n                        [\n                            landmark\n                            for landmark in mediapipe_results.pose_landmarks.landmark\n                        ]\n                    ]\n        elif hasattr(mediapipe_results, \"face_landmarks\"):\n            results = mediapipe_results.face_landmarks\n        elif hasattr(mediapipe_results, \"multi_face_landmarks\"):\n            if mediapipe_results.multi_face_landmarks is None:\n                results = []\n            else:\n                results = [\n                    face_landmark.landmark\n                    for face_landmark in mediapipe_results.multi_face_landmarks\n                ]\n        else:\n            # Reject unsupported MediaPipe-like payloads before landmark parsing.\n            raise ValueError(\n                \"Unsupported MediaPipe result type. Expected an object with \"\n                \"pose_landmarks, face_landmarks, or multi_face_landmarks.\"\n            )\n\n        if len(results) == 0:\n            return cls.empty()\n\n        xy = []\n        confidence = []\n        for pose in results:\n            prediction_xy = []\n            prediction_confidence = []\n            for landmark in pose:\n                keypoint_xy = [\n                    landmark.x * resolution_wh[0],\n                    landmark.y * resolution_wh[1],\n                ]\n                prediction_xy.append(keypoint_xy)","sourceCodeStart":551,"sourceCodeEnd":587,"githubUrl":"https://github.com/roboflow/supervision/blob/7f254d9784d4c37e0f03cd89ddee164c8db099c0/src/supervision/key_points/core.py#L551-L587","documentation":"Raised by KeyPoints.from_mediapipe() when the passed result object exposes none of the expected attributes: pose_landmarks, face_landmarks, or multi_face_landmarks. The connector duck-types MediaPipe outputs, so an object that does not look like a MediaPipe pose/face result cannot be parsed and is rejected with an explicit message rather than an AttributeError deeper in.","triggerScenarios":"Calling sv.KeyPoints.from_mediapipe(result) with the wrong MediaPipe task output — e.g. passing a MediaPipe Holistic result whose fields changed across versions, passing the raw SolutionOutputs wrapper vs the .pose_landmarks field, or passing a completely unrelated object.","commonSituations":"MediaPipe legacy Solutions vs new Tasks API objects having different attribute names; passing a list of NormalizedLandmark instead of the task result; version upgrades of mediapipe renaming fields.","solutions":["Pass the actual result object returned by process(), not a sub-field or a list: sv.KeyPoints.from_mediapipe(results.pose_landmarks and results) — from_mediapipe expects the container with pose_landmarks/face_landmarks attributes.","If using the new MediaPipe Tasks API, extract result.pose_landmarks (a list of NormalizedLandmark lists) into an object exposing pose_landmarks, or convert manually.","Verify with hasattr(result, 'pose_landmarks') before calling."],"exampleFix":"// before\nkp = sv.KeyPoints.from_mediapipe(result.landmarks)  # wrong object\n\n// after\nkp = sv.KeyPoints.from_mediapipe(result)  # object with pose_landmarks / face_landmarks attrs","handlingStrategy":"type-guard","validationCode":"result_attrs = {\"pose_landmarks\", \"face_landmarks\", \"multi_face_landmarks\"}\nif not (result_attrs & set(vars(result))):\n    raise TypeError(f\"Not a MediaPipe result: {type(result)}\")\nkp = sv.KeyPoints.from_mediapipe(result)","typeGuard":"def is_mediapipe_result(obj) -> bool:\n    return any(\n        hasattr(obj, a)\n        for a in (\"pose_landmarks\", \"face_landmarks\", \"multi_face_landmarks\")\n    )","tryCatchPattern":"try:\n    kp = sv.KeyPoints.from_mediapipe(result)\nexcept ValueError as e:\n    if \"Unsupported MediaPipe result type\" in str(e):\n        raise TypeError(f\"Wrong MediaPipe payload: {type(result)}\") from e\n    raise","preventionTips":["Pass the object returned by mediapipe process() directly, not extracted sub-lists.","Pin the mediapipe version — attribute names differ between legacy Solutions and Tasks APIs.","Wrap the connector once and test it against your exact MediaPipe version."],"tags":["keypoints","mediapipe","connector","api-mismatch"],"backgroundTag":null,"analyzedSha":"7f254d9784d4c37e0f03cd89ddee164c8db099c0","analyzedAt":"2026-08-15T05:13:01.950Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}