{"record":{"id":"116c79ddf0fe8768","repo":"BoundaryML/baml","slug":"invalid-client-property-should-have-been-a-google-ai","errorCode":null,"errorMessage":"Invalid client property. Should have been a google-ai property but got: {}","messagePattern":"Invalid client property\\. Should have been a google-ai property but got: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/baml-runtime/src/internal/llm_client/primitive/google/googleai_client.rs","lineNumber":52,"sourceCode":"\npub struct GoogleAIClient {\n    pub name: String,\n    pub client: reqwest::Client,\n    pub retry_policy: Option<String>,\n    pub context: RenderContext_Client,\n    pub features: ModelFeatures,\n    properties: ResolvedGoogleAI,\n}\n\nfn resolve_properties(\n    provider: &ClientProvider,\n    properties: &UnresolvedClientProperty<()>,\n    ctx: &RuntimeContext,\n) -> Result<ResolvedGoogleAI, anyhow::Error> {\n    let properties = properties.resolve(provider, &ctx.eval_ctx(false))?;\n\n    let ResolvedClientProperty::GoogleAI(props) = properties else {\n        anyhow::bail!(\n            \"Invalid client property. Should have been a google-ai property but got: {}\",\n            properties.name()\n        );\n    };\n\n    Ok(props)\n}\n\nimpl WithRetryPolicy for GoogleAIClient {\n    fn retry_policy_name(&self) -> Option<&str> {\n        self.retry_policy.as_deref()\n    }\n}\n\nimpl WithClientProperties for GoogleAIClient {\n    fn allowed_metadata(&self) -> &AllowedRoleMetadata {\n        &self.properties.allowed_metadata\n    }","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/engine/baml-runtime/src/internal/llm_client/primitive/google/googleai_client.rs#L34-L70","documentation":"resolve_properties resolves the client's UnresolvedClientProperty against the runtime context and expects the result to be the ResolvedClientProperty::GoogleAI variant. Any other variant (e.g. OpenAI, Anthropic, Aws) means the provider name and property type disagree, so BAML refuses to continue. This guards against a mislabeled or misparsed client definition.","triggerScenarios":"Declaring a client whose provider resolves to something other than google-ai but which flows into GoogleAIClient::new/dynamic_new — typically a typo in the provider string (e.g. \"google-ai \" with whitespace, wrong casing) or a client-override at runtime passing mismatched properties.","commonSituations":"Misspelling provider \"google-ai\" in the generator/client block; passing a dynamically constructed client property of the wrong type to dynamic_new; older BAML config formats where the provider key changed.","solutions":["Set the client provider exactly to \"google-ai\" in the BAML config block.","Check for typos/whitespace/casing in the provider name.","If using dynamic client construction, ensure the properties were built for the google-ai provider.","Upgrade BAML if your config uses an outdated provider naming scheme."],"exampleFix":"// before (baml)\nclient \"gemini\" { provider \"googleai\" ... }\n// after\nclient \"gemini\" { provider \"google-ai\" ... }","handlingStrategy":"validation","validationCode":"// baml config check\n// client \"gemini\" { provider \"google-ai\" options { api_key env.GEMINI_API_KEY } }\nif (!clientConfig.provider.startsWith('google-ai')) throw new Error(`google-ai client requires provider 'google-ai', got '${clientConfig.provider}'`);","typeGuard":null,"tryCatchPattern":"try { const r = await b.MyFunction(...) } catch (e) { if (String(e).includes('Should have been a google-ai property')) { console.error('Fix the client provider string in your BAML config'); } throw e; }","preventionTips":["Use the exact provider string \"google-ai\" in client blocks.","Match dynamic client properties to the provider they were built for.","Lint BAML config files for provider typos in CI."],"tags":["google-ai","client-config","provider","config-mismatch"],"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-23T08:17:48.524Z"}