{"record":{"id":"2e00d8948068238f","repo":"BoundaryML/baml","slug":"strategy-client-providers-are-not-supported-yet-in","errorCode":null,"errorMessage":"Strategy client providers are not supported yet in LLMPrimitiveProvider","messagePattern":"Strategy client providers are not supported yet in LLMPrimitiveProvider","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/baml-runtime/src/internal/llm_client/primitive/mod.rs","lineNumber":156,"sourceCode":"                    OpenAIClientProviderVariant::Transcriptions => {\n                        OpenAIClient::dynamic_new_transcriptions(value, ctx).map(Into::into)\n                    }\n                    OpenAIClientProviderVariant::OpenRouter => {\n                        OpenAIClient::dynamic_new_openrouter(value, ctx).map(Into::into)\n                    }\n                }\n            }\n            ClientProvider::Anthropic => AnthropicClient::dynamic_new(value, ctx).map(Into::into),\n            #[cfg(feature = \"bedrock\")]\n            ClientProvider::AwsBedrock => AwsClient::dynamic_new(value, ctx).map(Into::into),\n            #[cfg(not(feature = \"bedrock\"))]\n            ClientProvider::AwsBedrock => anyhow::bail!(\n                \"AWS Bedrock support was not compiled into this build (enable the `bedrock` feature)\"\n            ),\n            ClientProvider::GoogleAi => GoogleAIClient::dynamic_new(value, ctx).map(Into::into),\n            ClientProvider::Vertex => VertexClient::dynamic_new(value, ctx).map(Into::into),\n            ClientProvider::Strategy(strategy_client_provider) => {\n                unimplemented!(\n                    \"Strategy client providers are not supported yet in LLMPrimitiveProvider\"\n                )\n            } // \"openai\" => OpenAIClient::dynamic_new(value, ctx).map(Into::into),\n              // \"openai-generic\" => OpenAIClient::dynamic_new_generic(value, ctx).map(Into::into),\n              // \"azure-openai\" => OpenAIClient::dynamic_new_azure(value, ctx).map(Into::into),\n              // \"ollama\" => OpenAIClient::dynamic_new_ollama(value, ctx).map(Into::into),\n              // \"anthropic\" => AnthropicClient::dynamic_new(value, ctx).map(Into::into),\n              // \"google-ai\" => GoogleAIClient::dynamic_new(value, ctx).map(Into::into),\n              // \"vertex-ai\" => VertexClient::dynamic_new(value, ctx).map(Into::into),\n              // // dynamic_new is not implemented for aws::AwsClient\n              // other => {\n              //     let options = [\n              //         \"anthropic\",\n              //         \"azure-openai\",\n              //         \"google-ai\",\n              //         \"openai\",\n              //         \"openai-generic\",\n              //         \"vertex-ai\",","sourceCodeStart":138,"sourceCodeEnd":174,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/engine/baml-runtime/src/internal/llm_client/primitive/mod.rs#L138-L174","documentation":"LLMPrimitiveProvider::try_from for dynamic client construction does not support Strategy (fallback/shuffle etc.) client providers. Matching a ClientProvider::Strategy hits an unimplemented!() which panics rather than returning a graceful error. Strategy providers must be handled at a higher level (LLMRendererProvider / runtime client layer), not as a primitive client.","triggerScenarios":"Building a dynamic LLM client (e.g. via ctx.llm.stream/ClientRegistry in a BAML function or baml.ClientRegistry in code) where the configured client name resolves to a strategy provider instead of a concrete provider (openai, anthropic, google-ai, vertex).","commonSituations":"Users define a `strategy` client (e.g. fallback across OpenAI and Anthropic) in clients.baml and reference it programmatically through the dynamic API, which only supports primitive providers.","solutions":["Use the strategy client through the runtime's higher-level client API (e.g. via baml function invocation with ClientRegistry) instead of constructing an LLMPrimitiveProvider from it","Resolve the strategy to one of its concrete underlying providers and construct that primitive provider directly","Wait for/upgrade to a BAML version that implements Strategy support in LLMPrimitiveProvider","Avoid referencing strategy clients in dynamic/primitive contexts; declare a concrete provider in the client registry"],"exampleFix":"// before\nlet provider = LLMPrimitiveProvider::try_from((\"MyFallbackStrategy\".to_string(), &ctx)?)?;\n// after\nlet provider = LLMPrimitiveProvider::try_from((\"MyOpenAiClient\".to_string(), &ctx)?)?;","handlingStrategy":"validation","validationCode":"// Rust: check provider kind before constructing a primitive client\nif let ClientProvider::Strategy(_) = resolved.provider() {\n    return Err(anyhow::anyhow!(\"strategy clients are not supported in primitive provider; use a concrete client\"));\n}","typeGuard":"fn is_primitive(p: &ClientProvider) -> bool {\n    !matches!(p, ClientProvider::Strategy(_))\n}","tryCatchPattern":"// unimplemented!() panics, so guard before construction; if unavoidable, catch_upstream at the boundary\nlet result = std::panic::catch_unwind(|| LLMPrimitiveProvider::try_from(value));","preventionTips":["Never point dynamic/primitive client construction at strategy clients in clients.baml","Validate the resolved provider is concrete before calling try_from","Track BAML releases for Strategy support in LLMPrimitiveProvider"],"tags":["rust","baml","unsupported-feature","strategy-provider"],"backgroundTag":"unsupported-operation","analyzedSha":"bd85ce9dee1463ff04d27efd20531013a4ff46c1","analyzedAt":"2026-09-12T03:38:25.718Z","contentChangedAt":"2026-09-12T03:38:25.718Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}