{"record":{"id":"f9a7d0469d51c42b","repo":"BoundaryML/baml","slug":"invalid-client-property-should-have-been-a-openai-property","errorCode":null,"errorMessage":"Invalid client property. Should have been a openai property but got: {}","messagePattern":"Invalid client property\\. Should have been a openai property but got: (.+?)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"engine/baml-runtime/src/internal/llm_client/primitive/openai/properties/mod.rs","lineNumber":15,"sourceCode":"use internal_llm_client::{\n    openai::ResolvedOpenAI, ClientProvider, ResolvedClientProperty, UnresolvedClientProperty,\n};\n\nuse crate::RuntimeContext;\n\npub fn resolve_properties(\n    provider: &ClientProvider,\n    properties: &UnresolvedClientProperty<()>,\n    ctx: &RuntimeContext,\n) -> anyhow::Result<ResolvedOpenAI> {\n    let properties = properties.resolve(provider, &ctx.eval_ctx(false))?;\n\n    let ResolvedClientProperty::OpenAI(props) = properties else {\n        anyhow::bail!(\n            \"Invalid client property. Should have been a openai property but got: {}\",\n            properties.name()\n        );\n    };\n\n    Ok(props)\n}\n","sourceCodeStart":1,"sourceCodeEnd":23,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/engine/baml-runtime/src/internal/llm_client/primitive/openai/properties/mod.rs#L1-L23","documentation":"This helper resolves an UnresolvedClientProperty and asserts the resolved variant is ResolvedClientProperty::OpenAI. If the property resolves to any other provider variant (e.g. AWS, Google, Anthropic), the pattern match fails and the error reports the actual variant name. It is an internal type/assertion guard used by the OpenAI property resolution path.","triggerScenarios":"Passing a client property block that is not an OpenAI-family provider (e.g. `aws`, `google-ai`, or a named policy/wrapper property) into the OpenAI resolve_properties path — typically from miswired internal client construction or a provider string that dispatched to the OpenAI resolver with a non-OpenAI property.","commonSituations":"A typo or mismatch between the provider label and the property block in clients.baml; programmatic client construction where the wrong UnresolvedClientProperty is handed to the OpenAI resolver; version mismatches where a new provider variant reaches an older resolver.","solutions":["Check the client definition in clients.baml and ensure the provider is an OpenAI-family provider (openai / azure-openai / openai-generic) matching the property block.","Verify the error's trailing `{}` value — it names the property actually resolved — and fix the provider/property mismatch.","If constructing clients programmatically, pass the property belonging to the OpenAI provider to this resolver.","Upgrade baml to align resolver dispatch with newly added providers if using a recent provider type."],"exampleFix":"// before (mismatch)\nclient<MyClient> {\n  provider openai\n  options { ... } // actually a property resolved as AwsBedrock\n}\n// after\nclient<MyClient> {\n  provider openai\n  options {\n    model \"gpt-4o\"\n    api_key env.OPENAI_API_KEY\n  }\n}","handlingStrategy":"type-guard","validationCode":"// Ensure the provider is OpenAI-family before resolving via the OpenAI path\nfn is_openai_provider(provider: &str) -> bool {\n    matches!(provider, \"openai\" | \"azure-openai\" | \"openai-generic\")\n}","typeGuard":"fn as_openai_props(p: &ResolvedClientProperty) -> Option<&ResolvedOpenAI> {\n    match p {\n        ResolvedClientProperty::OpenAI(props) => Some(props),\n        _ => None,\n    }\n}","tryCatchPattern":null,"preventionTips":["Keep provider strings in clients.baml consistent with the options block shape.","Regenerate generated BAML clients after any provider change.","Match on ResolvedClientProperty variants explicitly instead of assuming OpenAI."],"tags":["openai","config","internal","baml"],"backgroundTag":"type-mismatch","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"}