microsoft/autogen · error · ValueError
Model does not support vision and image was provided
Error message
Model does not support vision and image was provided
What it means
Raised by AzureAIChatCompletionClient._validate_model_info during create()/create_stream() when self.model_info['vision'] is False and any UserMessage in the conversation has a list content containing at least one autogen Image. The client refuses to forward images to a model declared non-vision rather than let the service fail opaquely.
Source
Thrown at python/packages/autogen-ext/src/autogen_ext/models/azure/_azure_ai_client.py:341
def add_usage(self, usage: RequestUsage) -> None:
self._total_usage = RequestUsage(
self._total_usage.prompt_tokens + usage.prompt_tokens,
self._total_usage.completion_tokens + usage.completion_tokens,
)
def _validate_model_info(
self,
messages: Sequence[LLMMessage],
tools: Sequence[Tool | ToolSchema],
json_output: Optional[bool | type[BaseModel]],
create_args: Dict[str, Any],
) -> None:
if self.model_info["vision"] is False:
for message in messages:
if isinstance(message, UserMessage):
if isinstance(message.content, list) and any(isinstance(x, Image) for x in message.content):
raise ValueError("Model does not support vision and image was provided")
if json_output is not None:
if self.model_info["json_output"] is False and json_output is True:
raise ValueError("Model does not support JSON output")
if isinstance(json_output, type):
# TODO: we should support this in the future.
raise ValueError("Structured output is not currently supported for AzureAIChatCompletionClient")
if json_output is True and "response_format" not in create_args:
create_args["response_format"] = "json_object"
if self.model_info["json_output"] is False and json_output is True:
raise ValueError("Model does not support JSON output")
if self.model_info["function_calling"] is False and len(tools) > 0:
raise ValueError("Model does not support function calling")
async def create(View on GitHub (pinned to 027ecf0a37)
Solutions
- If the deployed model does support vision, fix model_info to vision=True
- If it truly does not, strip Image parts from UserMessage content before calling create (or replace with a text placeholder)
- Gate image-attaching code paths on client.model_info['vision']
Example fix
# before model_info = ModelInfo(family="llama-3-1-8b-instruct", vision=False, ...) await client.create([UserMessage(content=["what is this?", img], source="user")]) # after content = ["what is this?", img] if client.model_info["vision"] else ["what is this? (image omitted)"] await client.create([UserMessage(content=content, source="user")])
Defensive patterns
Strategy: validation
Validate before calling
from autogen_core.models import UserMessage, Image
def has_images(messages) -> bool:
return any(
isinstance(m, UserMessage) and isinstance(m.content, list)
and any(isinstance(p, Image) for p in m.content)
for m in messages
)
if client.model_info["vision"] is False:
assert not has_images(msgs), "cannot send images to a non-vision model" Type guard
from autogen_core.models import UserMessage, Image
def message_contains_image(msg) -> bool:
return isinstance(msg, UserMessage) and isinstance(msg.content, list) \
and any(isinstance(p, Image) for p in msg.content) Prevention
- Declare vision=True in model_info only when the deployment truly supports it
- Gate image attachment code on client.model_info['vision']
- Strip Image parts when routing histories to text-only models
When it happens
Trigger: Sending Image parts in a UserMessage to a model whose model_info was built with vision=False (e.g. a text-only Llama or GPT model deployed on Azure AI Foundry); reusing a vision conversation history after swapping to a text-only deployment.
Common situations: model_info copied from a text model while the deployment actually serves a vision model (mis-declared capabilities); pipeline branches that attach screenshots unconditionally.
Related errors
- Model does not support vision and image was provided
- Unknown content type: {message.content}
- model_info is required for AzureAIChatCompletionClient
- Model does not support JSON output
- Model does not support function calling
AI-assisted analysis of microsoft/autogen@027ecf0a37 (2026-08-15).
Data as JSON: /api/errors/025c96726c5c3b2d.
Report an issue: GitHub.