conductor-oss/conductor · error · UnsupportedOperationException

Chat completion is not supported by the Stability AI provide

Error message

Chat completion is not supported by the Stability AI provider

What it means

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.

Source

Thrown at ai/src/main/java/org/conductoross/conductor/ai/providers/stabilityai/StabilityAI.java:158

    }

    @Override
    public ImageOptions getImageOptions(ImageGenRequest input) {
        // Build standard ImageOptions. The model field controls endpoint routing
        // in our StabilityAiApi (sd3 vs core vs ultra).
        return org.springframework.ai.image.ImageOptionsBuilder.builder()
                .model(input.getModel())
                .N(input.getN())
                .height(input.getHeight())
                .width(input.getWidth())
                .responseFormat("b64_json")
                .style(input.getStyle())
                .build();
    }

    @Override
    public ChatModel getChatModel() {
        throw new UnsupportedOperationException(
                "Chat completion is not supported by the Stability AI provider");
    }

    @Override
    public List<Float> generateEmbeddings(EmbeddingGenRequest embeddingGenRequest) {
        throw new UnsupportedOperationException(
                "Embeddings are not supported by the Stability AI provider");
    }

    /**
     * Derive an aspect ratio string from width/height in ImageOptions.
     *
     * <p>The v2beta API accepts aspect ratios like "1:1", "16:9", "9:16", "3:2", "2:3", "4:5",
     * "5:4", "21:9", "9:21". If width and height are both provided, we compute the closest matching
     * ratio. If not provided, defaults to "1:1".
     */
    private static String deriveAspectRatio(ImageOptions options) {
        if (options == null || options.getWidth() == null || options.getHeight() == null) {

View on GitHub (pinned to cf7c3e4a8a)

Solutions

  1. Route chat tasks to a chat-capable provider (OpenAI, Anthropic, Perplexity).
  2. Guard getChatModel() calls with a provider/capability check.
  3. Correct the llmProvider on the chat task input.
Defensive patterns

Strategy: validation

Validate before calling

if ("stabilityai".equals(model.getModelProvider())) {
    throw new IllegalArgumentException(
        "Stability AI does not support chat completion");
}
ChatModel chat = model.getChatModel();

Type guard

boolean supportsChat(AIModel m) {
    return !"stabilityai".equals(m.getModelProvider());
}

Try / catch

try {
    ChatModel chat = model.getChatModel();
} catch (UnsupportedOperationException e) {
    // provider lacks chat; switch to OpenAI/Anthropic/Perplexity
}

Prevention

When it happens

Trigger: Calling getChatModel() on a StabilityAI instance, or routing a chat completion task to the stabilityai provider.

Common situations: A chat task whose llmProvider is set to stabilityai, or generic code invoking getChatModel() on every AIModel without a capability guard.

Related errors


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