{"record":{"id":"c747fe286e4695db","repo":"conductor-oss/conductor","slug":"chat-completion-is-not-supported-by-the-stability","errorCode":null,"errorMessage":"Chat completion is not supported by the Stability AI provider","messagePattern":"Chat completion is not supported by the Stability AI provider","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"ai/src/main/java/org/conductoross/conductor/ai/providers/stabilityai/StabilityAI.java","lineNumber":158,"sourceCode":"    }\n\n    @Override\n    public ImageOptions getImageOptions(ImageGenRequest input) {\n        // Build standard ImageOptions. The model field controls endpoint routing\n        // in our StabilityAiApi (sd3 vs core vs ultra).\n        return org.springframework.ai.image.ImageOptionsBuilder.builder()\n                .model(input.getModel())\n                .N(input.getN())\n                .height(input.getHeight())\n                .width(input.getWidth())\n                .responseFormat(\"b64_json\")\n                .style(input.getStyle())\n                .build();\n    }\n\n    @Override\n    public ChatModel getChatModel() {\n        throw new UnsupportedOperationException(\n                \"Chat completion is not supported by the Stability AI provider\");\n    }\n\n    @Override\n    public List<Float> generateEmbeddings(EmbeddingGenRequest embeddingGenRequest) {\n        throw new UnsupportedOperationException(\n                \"Embeddings are not supported by the Stability AI provider\");\n    }\n\n    /**\n     * Derive an aspect ratio string from width/height in ImageOptions.\n     *\n     * <p>The v2beta API accepts aspect ratios like \"1:1\", \"16:9\", \"9:16\", \"3:2\", \"2:3\", \"4:5\",\n     * \"5:4\", \"21:9\", \"9:21\". If width and height are both provided, we compute the closest matching\n     * ratio. If not provided, defaults to \"1:1\".\n     */\n    private static String deriveAspectRatio(ImageOptions options) {\n        if (options == null || options.getWidth() == null || options.getHeight() == null) {","sourceCodeStart":140,"sourceCodeEnd":176,"githubUrl":"https://github.com/conductor-oss/conductor/blob/cf7c3e4a8adfb158be778ab1ec525323c363cd3a/ai/src/main/java/org/conductoross/conductor/ai/providers/stabilityai/StabilityAI.java#L140-L176","documentation":"Thrown by StabilityAI.getChatModel as UnsupportedOperationException. Stability AI is an image-only provider; it has no chat/completion endpoint, so the AIModel.getChatModel method is intentionally unimplemented.","triggerScenarios":"Calling getChatModel() on a StabilityAI instance, or routing a chat completion task to the stabilityai provider.","commonSituations":"A chat task whose llmProvider is set to stabilityai, or generic code invoking getChatModel() on every AIModel without a capability guard.","solutions":["Route chat tasks to a chat-capable provider (OpenAI, Anthropic, Perplexity).","Guard getChatModel() calls with a provider/capability check.","Correct the llmProvider on the chat task input."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if (\"stabilityai\".equals(model.getModelProvider())) {\n    throw new IllegalArgumentException(\n        \"Stability AI does not support chat completion\");\n}\nChatModel chat = model.getChatModel();","typeGuard":"boolean supportsChat(AIModel m) {\n    return !\"stabilityai\".equals(m.getModelProvider());\n}","tryCatchPattern":"try {\n    ChatModel chat = model.getChatModel();\n} catch (UnsupportedOperationException e) {\n    // provider lacks chat; switch to OpenAI/Anthropic/Perplexity\n}","preventionTips":["Check getModelProvider() before calling getChatModel().","Route chat tasks to chat-capable providers.","Maintain a capability registry per provider."],"tags":["stabilityai","chat","unsupported-operation","provider-capabilities"],"backgroundTag":null,"analyzedSha":"cf7c3e4a8adfb158be778ab1ec525323c363cd3a","analyzedAt":"2026-08-14T03:33:19.897Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}