{"record":{"id":"ddffc3e1c98ee6fd","repo":"conductor-oss/conductor","slug":"image-generation-not-supported-by-the-model-yet-ddffc3","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/ollama/Ollama.java","lineNumber":111,"sourceCode":"                        .toolNames(toolNames)\n                        .internalToolExecutionEnabled(false)\n                        .presencePenalty(input.getPresencePenalty());\n\n        if (input.isJsonOutput()) {\n            builder.format(\"json\");\n        }\n\n        return builder.build();\n    }\n\n    @Override\n    public ChatModel getChatModel() {\n        return OllamaChatModel.builder().ollamaApi(buildOllamaApi()).build();\n    }\n\n    @Override\n    public ImageModel getImageModel() {\n        throw new UnsupportedOperationException(\"Image generation not supported by the model yet\");\n    }\n\n    private OllamaApi buildOllamaApi() {\n        OkHttpClient effective =\n                (config.getTimeout() != null)\n                        ? httpClient.newBuilder().readTimeout(config.getTimeout()).build()\n                        : httpClient;\n        var factory =\n                new org.springframework.http.client.OkHttp3ClientHttpRequestFactory(effective);\n        RestClient.Builder builder = RestClient.builder().requestFactory(factory);\n        if (StringUtils.isNotBlank(config.getAuthHeaderName())) {\n            builder.defaultHeader(config.getAuthHeaderName(), config.getAuthHeader());\n        }\n        return OllamaApi.builder().baseUrl(config.getBaseURL()).restClientBuilder(builder).build();\n    }\n}\n","sourceCodeStart":93,"sourceCodeEnd":128,"githubUrl":"https://github.com/conductor-oss/conductor/blob/cf7c3e4a8adfb158be778ab1ec525323c363cd3a/ai/src/main/java/org/conductoross/conductor/ai/providers/ollama/Ollama.java#L93-L128","documentation":"Ollama.java throws UnsupportedOperationException from getImageModel(). Ollama wires a chat model (OllamaChatModel) and embeddings but has no image-generation adapter. AIModel.getImageModel() is abstract (line 141), so Ollama throws.","triggerScenarios":"An image-generation Conductor task is configured with llmProvider=\"ollama\". LLMHelper.generateImage() calls llm.getImageModel() and the provider throws before any HTTP call to the Ollama daemon.","commonSituations":"Running Ollama locally for chat and assuming the same provider handles image generation; routing an image task to a local Ollama instance that only has text/vision models loaded.","solutions":["Switch the image task to a provider with a real ImageModel: openai, stabilityai, gemini, azureopenai, bedrock, or cohere.","Keep Ollama for chat and embeddings only.","If running a local image model, use stabilityai with a custom baseURL."],"exampleFix":"// before\n{\"llmProvider\": \"ollama\", \"prompt\": \"a cat\"}\n// after\n{\"llmProvider\": \"stabilityai\", \"model\": \"stable-diffusion-xl\", \"prompt\": \"a cat\"}","handlingStrategy":"validation","validationCode":"// Same IMAGE_CAPABLE set\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        \"Ollama does not support image generation. Use: \" + IMAGE_CAPABLE);\n}","typeGuard":"null","tryCatchPattern":"try {\n    ImageModel model = llm.getImageModel();\n} catch (UnsupportedOperationException e) {\n    throw new IllegalArgumentException(\"Ollama does not support image generation\", e);\n}","preventionTips":["Keep Ollama for chat and embeddings only.","For local image generation, use stabilityai with a custom baseURL to your local endpoint.","Validate provider capability before routing image tasks."],"tags":["ollama","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"}