conductor-oss/conductor · error · UnsupportedOperationException

Image generation not supported by the model yet

Error message

Image generation not supported by the model yet

What it means

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.

Source

Thrown at ai/src/main/java/org/conductoross/conductor/ai/providers/huggingface/HuggingFace.java:93

                .temperature(input.getTemperature())
                .topP(input.getTopP())
                .frequencyPenalty(input.getFrequencyPenalty())
                .presencePenalty(input.getPresencePenalty())
                .maxTokens(input.getMaxTokens())
                .stopSequences(input.getStopWords())
                .jsonOutput(input.isJsonOutput())
                .responsesApiTools(tools.isEmpty() ? null : tools)
                .build();
    }

    @Override
    public ChatModel getChatModel() {
        return this.chatModel;
    }

    @Override
    public ImageModel getImageModel() {
        throw new UnsupportedOperationException("Image generation not supported by the model yet");
    }

    private List<Tool> convertTools(ChatCompletion input) {
        List<Tool> tools = new ArrayList<>();
        if (input.getTools() != null) {
            for (ToolSpec toolSpec : input.getTools()) {
                tools.add(
                        Tool.function(
                                toolSpec.getName(),
                                toolSpec.getDescription(),
                                toolSpec.getInputSchema()));
            }
        }
        return tools;
    }
}

View on GitHub (pinned to cf7c3e4a8a)

Solutions

  1. Switch the image task to a provider that returns a real ImageModel: openai, stabilityai, gemini, azureopenai, bedrock, or cohere.
  2. For HuggingFace-hosted Stable Diffusion, use the stabilityai provider with a custom baseURL pointing at your endpoint.
  3. Keep HuggingFace only for text/chat tasks.

Example fix

// before
{"llmProvider": "huggingface", "prompt": "a sunset"}
// after
{"llmProvider": "stabilityai", "model": "stable-diffusion-xl", "prompt": "a sunset"}
Defensive patterns

Strategy: validation

Validate before calling

// Same IMAGE_CAPABLE set as error 200
private static final Set<String> IMAGE_CAPABLE = Set.of(
    "openai", "gemini", "azureopenai", "bedrock", "stabilityai", "cohere");

if (!IMAGE_CAPABLE.contains(request.getLlmProvider())) {
    throw new IllegalArgumentException(
        "HuggingFace does not support image generation. Use: " + IMAGE_CAPABLE);
}

Type guard

null

Try / catch

try {
    ImageModel model = llm.getImageModel();
} catch (UnsupportedOperationException e) {
    // HuggingFace is chat-only; route to a different provider for images
    throw new IllegalArgumentException("HuggingFace does not support image generation", e);
}

Prevention

When it happens

Trigger: An image-generation Conductor task uses llmProvider="huggingface". LLMHelper.generateImage() invokes llm.getImageModel(), which throws before any network I/O.

Common situations: 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).

Related errors


AI-assisted analysis of conductor-oss/conductor@cf7c3e4a8a (2026-08-14). Data as JSON: /api/errors/3cee66f26869ff6d. Report an issue: GitHub.