{"record":{"id":"4a7fda5660e60cc9","repo":"conductor-oss/conductor","slug":"not-supported","errorCode":null,"errorMessage":"Not supported","messagePattern":"Not supported","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"ai/src/main/java/org/conductoross/conductor/ai/providers/anthropic/Anthropic.java","lineNumber":79,"sourceCode":"    /**\n     * Anthropic Claude Sonnet 4.6+ rejects requests whose final message has the {@code assistant}\n     * role with {@code 400 \"This model does not support assistant message prefill. The conversation\n     * must end with a user message.\"} Earlier Claude models (Sonnet 4.5 and below) silently\n     * accepted prefill, which is the only reason {@link\n     * org.conductoross.conductor.ai.tasks.mapper.ChatCompleteTaskMapper}'s loop-history\n     * auto-injection ever worked on Anthropic — the injected messages arrived as accidental\n     * prefill. We declare {@code false} here so the mapper suppresses that injection across all\n     * Anthropic models; workflows that need prior-iteration state on an Anthropic loop should\n     * template it into the user message via {@code ${...output.result}}.\n     */\n    @Override\n    public boolean supportsAssistantPrefill() {\n        return false;\n    }\n\n    @Override\n    public List<Float> generateEmbeddings(EmbeddingGenRequest embeddingGenRequest) {\n        throw new UnsupportedOperationException(\"Not supported\");\n    }\n\n    @Override\n    public ChatModel getChatModel() {\n        return this.chatModel;\n    }\n\n    @Override\n    public ChatOptions getChatOptions(ChatCompletion input) {\n        List<Tool> tools = convertTools(input);\n        Double temperature = input.getTemperature();\n        Integer thinkingBudget = null;\n\n        if (input.getThinkingTokenLimit() > 0) {\n            thinkingBudget = input.getThinkingTokenLimit();\n            temperature = 1.0; // Thinking mode requires temperature=1\n        }\n","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/conductor-oss/conductor/blob/cf7c3e4a8adfb158be778ab1ec525323c363cd3a/ai/src/main/java/org/conductoross/conductor/ai/providers/anthropic/Anthropic.java#L61-L97","documentation":"Thrown by Anthropic.generateEmbeddings unconditionally — the Anthropic provider does not implement embeddings (Anthropic offers no embeddings API as of this code), so the method is a hard UnsupportedOperationException stub required by the AI provider interface. It is a capability declaration, not a runtime/conditional failure: calling it always throws.","triggerScenarios":"Calling generateEmbeddings on an Anthropic-backed AIConfig/AIProvider (e.g. a workflow configured to use an Anthropic model for an embeddings step, or generic code that iterates providers and calls generateEmbeddings without checking capability).","commonSituations":"Workflow/task configured with an embeddings operation but the selected provider/model is Anthropic; code that assumes every provider supports embeddings; misconfiguration routing an embedding request to the Anthropic provider.","solutions":["Use an embeddings-capable provider (e.g. OpenAI, Voyage, or another provider that implements generateEmbeddings) for embedding steps.","Check provider capability before calling — Anthropic explicitly does not support embeddings.","Fix the model/provider routing so embedding requests never reach the Anthropic provider.","If the workflow needs both chat and embeddings, configure separate providers per operation."],"exampleFix":"// before\nList<Float> vec = anthropicProvider.generateEmbeddings(req);\n// after\nif (provider instanceof Anthropic) {\n    throw new IllegalStateException(\"Anthropic does not support embeddings; use an embeddings-capable provider\");\n}\nList<Float> vec = provider.generateEmbeddings(req);","handlingStrategy":"type-guard","validationCode":"// Route embedding requests away from Anthropic at config/dispatch time.\nif (provider instanceof org.conductoross.conductor.ai.providers.anthropic.Anthropic) {\n    throw new IllegalStateException(\n        \"Anthropic does not provide embeddings; select an embeddings-capable provider\");\n}\nList<Float> vec = provider.generateEmbeddings(req);","typeGuard":"// Capability guard before calling generateEmbeddings.\nboolean supportsEmbeddings(Object provider) {\n    return !(provider instanceof org.conductoross.conductor.ai.providers.anthropic.Anthropic);\n}","tryCatchPattern":"try {\n    provider.generateEmbeddings(req);\n} catch (UnsupportedOperationException e) {\n    if (\"Not supported\".equals(e.getMessage())) {\n        // provider lacks embeddings; reconfigure to an embeddings-capable provider\n    }\n    throw e;\n}","preventionTips":["Never route embeddings operations to the Anthropic provider.","Check provider type/capability before dispatching embedding requests.","Use distinct providers for chat vs embeddings in mixed workflows."],"tags":["ai","anthropic","embeddings","unsupported-operation","capability"],"backgroundTag":null,"analyzedSha":"cf7c3e4a8adfb158be778ab1ec525323c363cd3a","analyzedAt":"2026-08-14T03:33:19.897Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}