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

MistralAI.java throws UnsupportedOperationException from getImageModel(). The Mistral provider wires chat (MistralAiChatModel) and embeddings but no image-generation adapter. AIModel.getImageModel() is abstract (line 141), so MistralAI throws to indicate the gap.

Source

Thrown at ai/src/main/java/org/conductoross/conductor/ai/providers/mistral/MistralAI.java:114

                        .toolNames(toolNames)
                        .internalToolExecutionEnabled(false);

        if (input.isJsonOutput()) {
            builder.responseFormat(
                    new MistralAiApi.ChatCompletionRequest.ResponseFormat("json_object"));
        }

        return builder.build();
    }

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

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

    // Initialization helpers

    private MistralAiApi createMistralAiApi(OkHttpClient httpClient) {
        OkHttpClient effective =
                (config.getTimeout() != null)
                        ? httpClient.newBuilder().readTimeout(config.getTimeout()).build()
                        : httpClient;
        var factory =
                new org.springframework.http.client.OkHttp3ClientHttpRequestFactory(effective);
        // Needs accept-encoding headers
        // https://github.com/spring-projects/spring-ai/issues/372
        return MistralAiApi.builder()
                .baseUrl(config.getBaseURL())
                .apiKey(config.getApiKey())
                .restClientBuilder(
                        RestClient.builder()

View on GitHub (pinned to cf7c3e4a8a)

Solutions

  1. Switch the image task to a provider that implements a real ImageModel: openai, gemini, azureopenai, stabilityai, bedrock, or cohere.
  2. Keep Mistral for chat and embeddings only.
  3. Contribute a MistralImageModel adapter if Mistral reintroduces an image API.

Example fix

// before
{"llmProvider": "mistral", "prompt": "a cat"}
// after
{"llmProvider": "openai", "model": "dall-e-3", "prompt": "a cat"}
Defensive patterns

Strategy: validation

Validate before calling

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

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

Type guard

null

Try / catch

try {
    ImageModel model = llm.getImageModel();
} catch (UnsupportedOperationException e) {
    throw new IllegalArgumentException("Mistral does not support image generation", e);
}

Prevention

When it happens

Trigger: An image-generation Conductor task uses llmProvider="mistral". LLMHelper.generateImage() calls llm.getImageModel() and the provider throws.

Common situations: Routing an image task to Mistral expecting it to use Mistral's (now-discontinued) image models; reusing a Mistral chat/embedding provider config for an image task.

Related errors


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