{"record":{"id":"e738fcf45f360dd9","repo":"BoundaryML/baml","slug":"invalid-client-property-should-have-been-a-openai-property-e738fc","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/openai.rs","lineNumber":18,"sourceCode":"use std::collections::HashMap;\n\nuse anyhow::{Context, Result};\nuse internal_llm_client::{openai::ResolvedOpenAI, ClientProvider, ResolvedClientProperty, UnresolvedClientProperty};\n\nuse crate::RuntimeContext;\n\nuse super::PostRequestProperties;\n\npub fn resolve_properties(\n    provider: &ClientProvider,\n    properties: &UnresolvedClientProperty<()>,\n    ctx: &RuntimeContext,\n) -> 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":26,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/engine/baml-runtime/src/internal/llm_client/primitive/openai/properties/openai.rs#L1-L26","documentation":"Same guard as the mod.rs resolver: the openai.rs resolve_properties expects the resolved client property to be the OpenAI variant, and bails with the actual property name if the destructuring `let ... else` fails. It indicates the OpenAI resolver received a property that resolved to a different provider type.","triggerScenarios":"Invoking the OpenAI-specific property resolution (properties/openai.rs) with an UnresolvedClientProperty that resolves to a non-OpenAI ResolvedClientProperty variant — e.g. an Azure, AWS, or retry-policy property passed by mistake.","commonSituations":"Hand-edited clients.baml where the provider string and the options block no longer correspond; runtime code that selects clients by name and hands the wrong property struct to the OpenAI path; stale generated code after changing a client's provider.","solutions":["Read the property name in the message and make the client's provider match an OpenAI provider in clients.baml.","Regenerate/reload the BAML runtime client so property dispatch matches the current .baml files.","If constructing clients in code, pass the OpenAI property to this resolver rather than another provider's."],"exampleFix":"// before\nclient<C> { provider aws-bedrock options { ... } } // fed to openai resolver\n// after\nclient<C> { provider openai options { model \"gpt-4o-mini\" api_key env.OPENAI_API_KEY } }","handlingStrategy":"type-guard","validationCode":"// Dispatch by resolved variant rather than assuming OpenAI\nmatch resolved_property {\n    ResolvedClientProperty::OpenAI(p) => openai_path(p),\n    other => return Err(anyhow!(\"expected OpenAI property, got {}\", other.name())),\n}","typeGuard":"let ResolvedClientProperty::OpenAI(props) = &resolved else {\n    anyhow::bail!(\"not an OpenAI property: {}\", resolved.name());\n};","tryCatchPattern":null,"preventionTips":["Verify the client's provider string after any rename in .baml files.","Run `baml-cli check` in CI to catch provider/property mismatches early.","Avoid constructing UnresolvedClientProperty values by hand; use the BAML runtime's client lookup."],"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"}