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

Thrown unconditionally by Anthropic.getImageModel() because Anthropic Claude models are text/multimodal chat models with no native image-generation capability. The AIModel interface requires every provider to implement getImageModel(), and Anthropic fulfills the contract by throwing UnsupportedOperationException rather than returning a non-functional model. The 'yet' in the message is aspirational — the capability is not on any current Claude roadmap.

Source

Thrown at ai/src/main/java/org/conductoross/conductor/ai/providers/anthropic/Anthropic.java:119

        }

        return AnthropicChatOptions.builder()
                .model(input.getModel())
                .maxTokens(maxTokens)
                .temperature(temperature)
                .topP(input.getTopP())
                .topK(input.getTopK())
                .stopSequences(input.getStopWords())
                .thinkingBudgetTokens(thinkingBudget)
                .reasoningEffort(input.getReasoningEffort())
                .reasoningSummary(input.getReasoningSummary())
                .tools(tools.isEmpty() ? null : tools)
                .build();
    }

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

    // -- Helpers --

    @SuppressWarnings("unchecked")
    private List<Tool> convertTools(ChatCompletion input) {
        List<Tool> tools = new ArrayList<>();

        // Built-in tools
        if (input.isWebSearch()) {
            tools.add(Tool.webSearch());
        }
        if (input.isCodeInterpreter()) {
            tools.add(Tool.codeExecution());
        }

        // Convert Conductor ToolSpecs to Anthropic function tools
        if (input.getTools() != null) {

View on GitHub (pinned to cf7c3e4a8a)

Solutions

  1. Route the image generation request to a provider that supports it: 'openai', 'azure_openai', 'vertex_ai'/'google_gemini', or 'stabilityai'.
  2. Add a capability check before calling getImageModel() — verify the provider name is in the set of image-capable providers.
  3. If building a generic dispatcher, catch UnsupportedOperationException and present a user-facing error indicating the provider lacks image support.

Example fix

// before
ImageModel imageModel = aiModel.getImageModel();

// after
if (!SUPPORTS_IMAGE.contains(aiModel.getModelProvider())) {
    throw new IllegalArgumentException(
        "Provider " + aiModel.getModelProvider() + " does not support image generation");
}
ImageModel imageModel = aiModel.getImageModel();
Defensive patterns

Strategy: validation

Validate before calling

// Validate provider supports image generation before calling getImageModel()
private static final Set<String> IMAGE_CAPABLE_PROVIDERS =
    Set.of("openai", "azure_openai", "vertex_ai", "google_gemini", "stabilityai");

void validateImageCapability(AIModel provider) {
    if (!IMAGE_CAPABLE_PROVIDERS.contains(provider.getModelProvider())) {
        throw new IllegalArgumentException(
            "Provider '" + provider.getModelProvider()
            + "' does not support image generation. "
            + "Supported: " + IMAGE_CAPABLE_PROVIDERS);
    }
}

Type guard

// Check whether an AIModel instance supports image generation
static boolean supportsImageGeneration(AIModel model) {
    try {
        return model.getImageModel() != null;
    } catch (UnsupportedOperationException e) {
        return false;
    }
}

Try / catch

try {
    ImageModel imageModel = aiModel.getImageModel();
} catch (UnsupportedOperationException e) {
    throw new IllegalArgumentException(
        "Provider " + aiModel.getModelProvider()
        + " does not support image generation. "
        + "Use openai, azure_openai, vertex_ai, or stabilityai.", e);
}

Prevention

When it happens

Trigger: Any code path that calls aiModel.getImageModel() on a provider resolved to the 'anthropic' name. This includes a Conductor GenerateImage task whose provider field is set to 'anthropic', or a generic capability-dispatch router that iterates providers and calls getImageModel() without checking which provider it holds.

Common situations: Misconfiguring an image-generation workflow/task to target the Anthropic provider. A generic task mapper that assumes all providers support all capability types. Copying a task definition from a working OpenAI image task and only changing the model name to a Claude model.

Related errors


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