{"record":{"id":"f6042c8d98c2a393","repo":"microsoft/autogen","slug":"model-does-not-support-json-output","errorCode":null,"errorMessage":"Model does not support JSON output","messagePattern":"Model does not support JSON output","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/packages/autogen-ext/src/autogen_ext/models/anthropic/_anthropic_client.py","lineNumber":576,"sourceCode":"        json_output: Optional[bool | type[BaseModel]] = None,\n        extra_create_args: Mapping[str, Any] = {},\n        cancellation_token: Optional[CancellationToken] = None,\n    ) -> CreateResult:\n        # Copy create args and update with extra args\n        create_args = self._create_args.copy()\n        create_args.update(extra_create_args)\n\n        # Check for vision capability if images are present\n        if self.model_info[\"vision\"] is False:\n            for message in messages:\n                if isinstance(message, UserMessage):\n                    if isinstance(message.content, list) and any(isinstance(x, Image) for x in message.content):\n                        raise ValueError(\"Model does not support vision and image was provided\")\n\n        # Handle JSON output format\n        if json_output is not None:\n            if self.model_info[\"json_output\"] is False and json_output is True:\n                raise ValueError(\"Model does not support JSON output\")\n\n            if json_output is True:\n                create_args[\"response_format\"] = {\"type\": \"json_object\"}\n            elif isinstance(json_output, type):\n                raise ValueError(\"Structured output is currently not supported for Anthropic models\")\n\n        # Process system message separately\n        system_message = None\n        anthropic_messages: List[MessageParam] = []\n\n        # Merge continuous system messages into a single message\n        messages = self._merge_system_messages(messages)\n        messages = self._rstrip_last_assistant_message(messages)\n\n        for message in messages:\n            if isinstance(message, SystemMessage):\n                if system_message is not None:\n                    # if that case, system message is must only one","sourceCodeStart":558,"sourceCodeEnd":594,"githubUrl":"https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/python/packages/autogen-ext/src/autogen_ext/models/anthropic/_anthropic_client.py#L558-L594","documentation":"Error \"Model does not support JSON output\" thrown in microsoft/autogen.","triggerScenarios":"Thrown at python/packages/autogen-ext/src/autogen_ext/models/anthropic/_anthropic_client.py:576 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Disable json_output or choose a model supporting it"],"exampleFix":"Set json_output=False or use a json-capable model","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"027ecf0a379bcc1d09956d46d12d44a3ad9cee14","analyzedAt":"2026-08-15T03:38:00.719Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}