{"record":{"id":"3cee66f26869ff6d","repo":"conductor-oss/conductor","slug":"image-generation-not-supported-by-the-model-yet-3cee66","errorCode":null,"errorMessage":"Image generation not supported by the model yet","messagePattern":"Image generation not supported by the model yet","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"ai/src/main/java/org/conductoross/conductor/ai/providers/huggingface/HuggingFace.java","lineNumber":93,"sourceCode":"                .temperature(input.getTemperature())\n                .topP(input.getTopP())\n                .frequencyPenalty(input.getFrequencyPenalty())\n                .presencePenalty(input.getPresencePenalty())\n                .maxTokens(input.getMaxTokens())\n                .stopSequences(input.getStopWords())\n                .jsonOutput(input.isJsonOutput())\n                .responsesApiTools(tools.isEmpty() ? null : tools)\n                .build();\n    }\n\n    @Override\n    public ChatModel getChatModel() {\n        return this.chatModel;\n    }\n\n    @Override\n    public ImageModel getImageModel() {\n        throw new UnsupportedOperationException(\"Image generation not supported by the model yet\");\n    }\n\n    private List<Tool> convertTools(ChatCompletion input) {\n        List<Tool> tools = new ArrayList<>();\n        if (input.getTools() != null) {\n            for (ToolSpec toolSpec : input.getTools()) {\n                tools.add(\n                        Tool.function(\n                                toolSpec.getName(),\n                                toolSpec.getDescription(),\n                                toolSpec.getInputSchema()));\n            }\n        }\n        return tools;\n    }\n}\n","sourceCodeStart":75,"sourceCodeEnd":110,"githubUrl":"https://github.com/conductor-oss/conductor/blob/cf7c3e4a8adfb158be778ab1ec525323c363cd3a/ai/src/main/java/org/conductoross/conductor/ai/providers/huggingface/HuggingFace.java#L75-L110","documentation":"HuggingFace.java throws UnsupportedOperationException from getImageModel() because HuggingFace's chat provider (OpenAI Responses API adapter) has no image-generation capability. AIModel.getImageModel() is abstract (line 141); HuggingFace fulfills it by throwing. LLMHelper.generateImage() calls llm.getImageModel() at line 155 unconditionally.","triggerScenarios":"An image-generation Conductor task uses llmProvider=\"huggingface\". LLMHelper.generateImage() invokes llm.getImageModel(), which throws before any network I/O.","commonSituations":"Routing an image-generation task to a chat-only HuggingFace deployment; assuming HuggingFace text-to-image models (e.g. Stable Diffusion on Inference Endpoints) are wired here (they are not — use stabilityai provider for that).","solutions":["Switch the image task to a provider that returns a real ImageModel: openai, stabilityai, gemini, azureopenai, bedrock, or cohere.","For HuggingFace-hosted Stable Diffusion, use the stabilityai provider with a custom baseURL pointing at your endpoint.","Keep HuggingFace only for text/chat tasks."],"exampleFix":"// before\n{\"llmProvider\": \"huggingface\", \"prompt\": \"a sunset\"}\n// after\n{\"llmProvider\": \"stabilityai\", \"model\": \"stable-diffusion-xl\", \"prompt\": \"a sunset\"}","handlingStrategy":"validation","validationCode":"// Same IMAGE_CAPABLE set as error 200\nprivate static final Set<String> IMAGE_CAPABLE = Set.of(\n    \"openai\", \"gemini\", \"azureopenai\", \"bedrock\", \"stabilityai\", \"cohere\");\n\nif (!IMAGE_CAPABLE.contains(request.getLlmProvider())) {\n    throw new IllegalArgumentException(\n        \"HuggingFace does not support image generation. Use: \" + IMAGE_CAPABLE);\n}","typeGuard":"null","tryCatchPattern":"try {\n    ImageModel model = llm.getImageModel();\n} catch (UnsupportedOperationException e) {\n    // HuggingFace is chat-only; route to a different provider for images\n    throw new IllegalArgumentException(\"HuggingFace does not support image generation\", e);\n}","preventionTips":["For HuggingFace-hosted image models (Stable Diffusion), use the stabilityai provider instead.","Validate provider capability before task execution.","Keep HuggingFace provider for text/chat tasks only."],"tags":["huggingface","image-generation","unsupported-operation","ai","provider"],"backgroundTag":null,"analyzedSha":"cf7c3e4a8adfb158be778ab1ec525323c363cd3a","analyzedAt":"2026-08-14T03:33:19.897Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}