{"record":{"id":"1a556cab1a814d59","repo":"microsoft/semantic-kernel","slug":"neither-of-the-media-types-of-operation-id-is-su","errorCode":null,"errorMessage":"Neither of the media types of {operation_id} is supported.","messagePattern":"Neither of the media types of (.+?) is supported\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"python/semantic_kernel/connectors/openapi_plugin/openapi_parser.py","lineNumber":143,"sourceCode":"            )\n\n            result.append(property)\n\n        return result\n\n    def _create_rest_api_operation_payload(\n        self, operation_id: str, request_body: dict[str, Any]\n    ) -> RestApiPayload | None:\n        if request_body is None or request_body.get(\"content\") is None:\n            return None\n\n        content = request_body.get(\"content\")\n        if content is None:\n            return None\n\n        media_type = next((mt for mt in OpenApiParser.SUPPORTED_MEDIA_TYPES if mt in content), None)\n        if media_type is None:\n            raise Exception(f\"Neither of the media types of {operation_id} is supported.\")\n\n        media_type_metadata = content[media_type]\n        payload_properties = self._get_payload_properties(\n            operation_id, media_type_metadata[\"schema\"], media_type_metadata[\"schema\"].get(\"required\", set())\n        )\n        return RestApiPayload(\n            media_type,\n            payload_properties,\n            request_body.get(\"description\"),\n            schema=media_type_metadata.get(\"schema\", None),\n        )\n\n    def _create_response(self, responses: dict[str, Any]) -> Generator[tuple[str, RestApiExpectedResponse], None, None]:\n        for response_key, response_value in responses.items():\n            media_type = next(\n                (mt for mt in OpenApiParser.SUPPORTED_MEDIA_TYPES if mt in response_value.get(\"content\", {})), None\n            )\n            if media_type is not None:","sourceCodeStart":125,"sourceCodeEnd":161,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/python/semantic_kernel/connectors/openapi_plugin/openapi_parser.py#L125-L161","documentation":"`_create_rest_api_operation_payload` picks the first media type in the request body `content` that appears in `OpenApiParser.SUPPORTED_MEDIA_TYPES`; if none match, it raises a bare `Exception` naming the operation. Only the supported media types can be turned into a payload property tree.","triggerScenarios":"An operation whose `requestBody.content` lists only unsupported media types (e.g. `application/xml`, `multipart/form-data`, `application/octet-stream`, or a custom vendor type) and none of the supported ones (typically `application/json`).","commonSituations":"XML-only or multipart APIs; specs that default to a vendor media type; binary-upload endpoints modeled via request body; specs imported from a SOAP/REST converter.","solutions":["Add an `application/json` media type entry to the request body for that operation.","If the API genuinely only supports XML/multipart, exclude that operation from registration via include/exclude filters.","Send the body as a raw string argument (set `payload_argument_name`) if you need a non-JSON body, after excluding dynamic payload building.","Pre-process the spec to add a JSON variant before loading."],"exampleFix":"# before\nrequestBody:\n  content:\n    application/xml: { schema: { ... } }   # raises 1492\n\n# after\nrequestBody:\n  content:\n    application/json: { schema: { ... } }","handlingStrategy":"validation","validationCode":"SUPPORTED = {\"application/json\"}  # mirror OpenApiParser.SUPPORTED_MEDIA_TYPES\n\ndef unsupported_body_ops(spec) -> list[str]:\n    bad = []\n    for path, methods in spec.get(\"paths\", {}).items():\n        for method, d in methods.items():\n            content = (d.get(\"requestBody\") or {}).get(\"content\", {})\n            if content and not (set(content) & SUPPORTED):\n                bad.append(f\"{method} {path}: {list(content)}\")\n    return bad\n\nproblems = unsupported_body_ops(spec)\nassert not problems, problems","typeGuard":"def has_supported_media_type(op_details) -> bool:\n    content = (op_details.get(\"requestBody\") or {}).get(\"content\", {})\n    return bool(set(content) & {\"application/json\"})","tryCatchPattern":"try:\n    kernel.add_openapi_plugin(plugin_name=\"x\", openapi_parsed_spec=spec)\nexcept Exception as e:  # bare Exception per source\n    if \"Neither of the media types\" in str(e):\n        # add application/json to the op, or exclude it, then retry\n        raise\n    raise","preventionTips":["Add `application/json` to request bodies you want registered.","Exclude binary/multipart/XML endpoints via operation filters.","Lint specs to flag unsupported-media-type bodies.","Pre-process vendor specs to add a JSON variant."],"tags":["openapi-plugin","media-type","parsing","semantic-kernel"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}