{"record":{"id":"4600a02b423e4206","repo":"FoundationAgents/OpenManus","slug":"model-self-model-does-not-support-images-use-a","errorCode":null,"errorMessage":"Model {self.model} does not support images. Use a model from {MULTIMODAL_MODELS}","messagePattern":"Model (.+?) does not support images\\. Use a model from (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"app/llm.py","lineNumber":519,"sourceCode":"            images: List of image URLs or image data dictionaries\n            system_msgs: Optional system messages to prepend\n            stream (bool): Whether to stream the response\n            temperature (float): Sampling temperature for the response\n\n        Returns:\n            str: The generated response\n\n        Raises:\n            TokenLimitExceeded: If token limits are exceeded\n            ValueError: If messages are invalid or response is empty\n            OpenAIError: If API call fails after retries\n            Exception: For unexpected errors\n        \"\"\"\n        try:\n            # For ask_with_images, we always set supports_images to True because\n            # this method should only be called with models that support images\n            if self.model not in MULTIMODAL_MODELS:\n                raise ValueError(\n                    f\"Model {self.model} does not support images. Use a model from {MULTIMODAL_MODELS}\"\n                )\n\n            # Format messages with image support\n            formatted_messages = self.format_messages(messages, supports_images=True)\n\n            # Ensure the last message is from the user to attach images\n            if not formatted_messages or formatted_messages[-1][\"role\"] != \"user\":\n                raise ValueError(\n                    \"The last message must be from the user to attach images\"\n                )\n\n            # Process the last user message to include images\n            last_message = formatted_messages[-1]\n\n            # Convert content to multimodal format if needed\n            content = last_message[\"content\"]\n            multimodal_content = (","sourceCodeStart":501,"sourceCodeEnd":537,"githubUrl":"https://github.com/FoundationAgents/OpenManus/blob/52a13f2a57d8c7f6737eefb02ccf569594d44273/app/llm.py#L501-L537","documentation":"Raised by LLM.ask_with_images() when self.model is not in the MULTIMODAL_MODELS allowlist. The method attaches image_url content parts, which text-only models reject or silently mishandle, so it refuses up front. The allowlist is a module-level constant in this package, not provider capability discovery.","triggerScenarios":"Constructing LLM with a text-only model (e.g. \"gpt-3.5-turbo\" or a non-vision fine-tune) then calling ask_with_images(); model name casing/alias mismatch causing the string to miss the allowlist; new vision model not yet added to MULTIMODAL_MODELS in this version.","commonSituations":"Switching the [llm] config to a cheaper text model and forgetting a code path calls ask_with_images; using a custom/local model name that is vision-capable but absent from the constant; version lag where a newly released vision model isn't in the list.","solutions":["Use a model from MULTIMODAL_MODELS, e.g. set model=\"gpt-4o\" in config before calling ask_with_images()","If your model truly supports vision but isn't listed, add it to MULTIMODAL_MODELS in the module (or upgrade the package)","Branch your code: call ask() for text-only models and ask_with_images() only for vision models"],"exampleFix":"# before\nllm = LLM(model=\"gpt-3.5-turbo\")\nawait llm.ask_with_images(\"describe\", [img])  # ValueError\n\n# after\nllm = LLM(model=\"gpt-4o\")\nawait llm.ask_with_images(\"describe\", [img])","handlingStrategy":"type-guard","validationCode":"from app.llm import MULTIMODAL_MODELS\n\ndef model_supports_images(model: str) -> bool:\n    return model in MULTIMODAL_MODELS","typeGuard":"from typing import TypeGuard\nfrom app.llm import MULTIMODAL_MODELS\n\ndef is_vision_model(model: object) -> TypeGuard[str]:\n    return isinstance(model, str) and model in MULTIMODAL_MODELS","tryCatchPattern":"try:\n    out = await llm.ask_with_images(\"describe\", images)\nexcept ValueError as e:\n    if \"does not support images\" in str(e):\n        out = await llm.ask(\"describe (images omitted)\")  # degrade to text\n    else:\n        raise","preventionTips":["Gate vision code paths behind a MULTIMODAL_MODELS membership check","Pin vision-capable models in config for any feature that sends images","After package upgrades, re-check the MULTIMODAL_MODELS list before adding new models"],"tags":["llm","multimodal","images","model-support"],"backgroundTag":null,"analyzedSha":"52a13f2a57d8c7f6737eefb02ccf569594d44273","analyzedAt":"2026-08-15T02:33:49.993Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}