{"record":{"id":"613747b63cfb5868","repo":"BoundaryML/baml","slug":"invalid-client-property-should-have-been-a-round-robin","errorCode":null,"errorMessage":"Invalid client property. Should have been a round-robin property but got: {}","messagePattern":"Invalid client property\\. Should have been a round-robin property but got: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/baml-runtime/src/internal/llm_client/strategy/roundrobin.rs","lineNumber":59,"sourceCode":"    pub fn current_index(&self) -> usize {\n        self.current_index\n            .load(std::sync::atomic::Ordering::Relaxed)\n    }\n\n    pub fn increment_index(&self) {\n        self.current_index\n            .fetch_add(1, std::sync::atomic::Ordering::Relaxed);\n    }\n}\n\nfn resolve_strategy(\n    provider: &ClientProvider,\n    properties: &UnresolvedClientProperty<()>,\n    ctx: &RuntimeContext,\n) -> Result<(Vec<ClientSpec>, usize)> {\n    let properties = properties.resolve(provider, &ctx.eval_ctx(false))?;\n    let ResolvedClientProperty::RoundRobin(props) = properties else {\n        anyhow::bail!(\n            \"Invalid client property. Should have been a round-robin property but got: {}\",\n            properties.name()\n        );\n    };\n    let start = match props.start_index {\n        Some(start) => (start as usize) % props.strategy.len(),\n        None => {\n            if cfg!(target_arch = \"wasm32\") {\n                // For VSCode, we don't want a random start point,\n                // as it can make rendering inconsistent\n                0\n            } else {\n                fastrand::usize(..props.strategy.len())\n            }\n        }\n    };\n    Ok((props.strategy, start))\n}","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/engine/baml-runtime/src/internal/llm_client/strategy/roundrobin.rs#L41-L77","documentation":"Type-mismatch guard while building a RoundRobin strategy client: after resolving the client property against the declared provider, the result was expected to be a RoundRobin property but resolved to a different shape. This means the client's declared provider and its property body disagree (e.g. provider = 'round-robin' but the body carries fallback-style fields), or resolution produced an unexpected variant.","triggerScenarios":"Declaring `strategy RoundRobin` whose properties resolve to something else — e.g. a fallback-shaped property assigned to a round-robin strategy client, or the strategy body missing the expected round-robin structure.","commonSituations":"Config where `provider round-robin` is set but the property body is a fallback block (or vice versa after copy-paste), or pointing a round-robin strategy at a plain (non-strategy) client property.","solutions":["Ensure the strategy body is a round-robin property: `strategy { ClientA ClientB }` (optionally with start_index).","If a fallback list was intended, change the provider to `fallback`.","Check for copy-paste mixing of fallback and round-robin blocks.","Regenerate and re-validate the .baml config."],"exampleFix":"// before\nclient<Strategy> S {\n  provider round-robin\n  strategy fallback { A B }  // wrong shape\n}\n\n// after\nclient<Strategy> S {\n  provider round-robin\n  strategy { A B }\n}","handlingStrategy":"validation","validationCode":"const resolved = clientProperties.resolve();\nif (resolved.kind !== 'round_robin') {\n  throw new Error(`provider round-robin requires a round-robin strategy block, got ${resolved.kind}`);\n}","typeGuard":"function isRoundRobinProperty(p) { return p && p.strategy === 'round_robin' && Array.isArray(p.strategyClients); }","tryCatchPattern":"try { loadClient('MyRRStrategy'); } catch (e) { if (String(e).includes('Should have been a round-robin property')) fixStrategyBlock(); }","preventionTips":["Keep round-robin blocks in the canonical `strategy { A B }` shape","Validate .baml with `baml-cli dev` before deploying","Don't nest fallback syntax inside round-robin strategy clients"],"tags":["configuration","baml","strategy","round-robin"],"backgroundTag":"invalid-config-value","analyzedSha":"bd85ce9dee1463ff04d27efd20531013a4ff46c1","analyzedAt":"2026-09-12T03:38:25.718Z","contentChangedAt":"2026-09-12T03:38:25.718Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}