BoundaryML/baml · error

Unsupported strategy provider: {}

Error message

Unsupported strategy provider: {}

What it means

Strategy-client construction error from the ClientWalker TryFrom impl: the client's provider is a Strategy provider whose concrete kind did not match any supported strategy implementation (round-robin or fallback). This guard is the match's catch-all for an unrecognized StrategyClientProvider variant — typically from a newer/older config schema than this runtime understands.

Source

Thrown at engine/baml-runtime/src/internal/llm_client/strategy/mod.rs:53

        }
    }
}

impl TryFrom<(&ClientWalker<'_>, &RuntimeContext)> for LLMStrategyProvider {
    type Error = anyhow::Error;

    fn try_from((client, ctx): (&ClientWalker, &RuntimeContext)) -> Result<Self> {
        match &client.elem().provider {
            ClientProvider::Strategy(strategy_client_provider) => match strategy_client_provider {
                StrategyClientProvider::RoundRobin => RoundRobinStrategy::try_from((client, ctx))
                    .map(Arc::new)
                    .map(LLMStrategyProvider::RoundRobin),
                StrategyClientProvider::Fallback => {
                    FallbackStrategy::try_from((client, ctx)).map(LLMStrategyProvider::Fallback)
                }
            },
            _ => {
                anyhow::bail!("Unsupported strategy provider: {}", client.elem().provider,)
            }
        }
    }
}

impl TryFrom<(&ClientProperty, &RuntimeContext)> for LLMStrategyProvider {
    type Error = anyhow::Error;

    fn try_from((client, ctx): (&ClientProperty, &RuntimeContext)) -> Result<Self> {
        match &client.provider {
            ClientProvider::Strategy(strategy) => match strategy {
                StrategyClientProvider::RoundRobin => RoundRobinStrategy::try_from((client, ctx))
                    .map(Arc::new)
                    .map(LLMStrategyProvider::RoundRobin),
                StrategyClientProvider::Fallback => {
                    FallbackStrategy::try_from((client, ctx)).map(LLMStrategyProvider::Fallback)
                }
            },

View on GitHub (pinned to bd85ce9dee)

Solutions

  1. Change the strategy client's provider to `fallback` or `round-robin` exactly.
  2. Fix casing/spelling: `round-robin`, not `round_robin` or `roundrobin`.
  3. Move model-provider options (openai, anthropic, ...) to the inner clients referenced by the strategy, not the strategy itself.
  4. Re-run `baml-cli generate` and check the error message's reported provider value.

Example fix

// before
client<Strategy> MyStrategy { provider openai ... }

// after
client<Strategy> MyStrategy {
  provider fallback
  strategy { ClientA ClientB }
}
Defensive patterns

Strategy: validation

Validate before calling

const ALLOWED = ['round-robin', 'fallback'];
if (!ALLOWED.includes(strategyClient.provider)) {
  throw new Error(`strategy provider must be one of ${ALLOWED}, got ${strategyClient.provider}`);
}

Type guard

function isStrategyProvider(p) { return p === 'round-robin' || p === 'fallback'; }

Try / catch

try { loadStrategy(cfg); } catch (e) { if (String(e).startsWith('Unsupported strategy provider')) console.error('Fix provider to round-robin or fallback'); }

Prevention

When it happens

Trigger: Writing `provider <something-else>` inside a strategy client block, e.g. `provider openai` or a typo like `provider roundrobin`, then attempting to construct the strategy at client resolution time.

Common situations: Typos (`round_robin` vs `round-robin`), using a model provider name where a strategy provider is expected, or older config files using renamed provider values.

Related errors


AI-assisted analysis of BoundaryML/baml@bd85ce9dee (2026-09-12). Data as JSON: /api/errors/a1f496fe4da1c3b5. Report an issue: GitHub.