{"record":{"id":"47e1f79c84df3677","repo":"BoundaryML/baml","slug":"region-cannot-be-empty","errorCode":null,"errorMessage":"region cannot be empty","messagePattern":"region cannot be empty","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/baml-lib/llm-client/src/clients/aws_bedrock.rs","lineNumber":260,"sourceCode":"        env_vars.extend(self.supported_request_modes.required_env_vars());\n        if let Some(c) = self.inference_config.as_ref() {\n            env_vars.extend(c.required_env_vars())\n        }\n        env_vars\n    }\n\n    pub fn resolve(&self, ctx: &EvaluationContext<'_>) -> Result<ResolvedAwsBedrock> {\n        let Some(model) = self.model.as_ref() else {\n            return Err(anyhow::anyhow!(\"model must be provided\"));\n        };\n\n        let role_selection = self.role_selection.resolve(ctx)?;\n\n        let region = match self.region.as_ref() {\n            Some(region) => {\n                let region = region.resolve(ctx)?;\n                if region.is_empty() {\n                    return Err(anyhow::anyhow!(\"region cannot be empty\"));\n                }\n                Some(region)\n            }\n            None => match ctx.get_env_var(\"AWS_REGION\") {\n                Ok(region) if !region.is_empty() => Some(region),\n                _ => match ctx.get_env_var(\"AWS_DEFAULT_REGION\") {\n                    Ok(region) if !region.is_empty() => Some(region),\n                    _ => None,\n                },\n            },\n        };\n\n        let access_key_id = match self.access_key_id.as_ref() {\n            Some(access_key_id) => Some(access_key_id.resolve(ctx)?),\n            None => None,\n        };\n\n        let secret_access_key = self","sourceCodeStart":242,"sourceCodeEnd":278,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/engine/baml-lib/llm-client/src/clients/aws_bedrock.rs#L242-L278","documentation":"When a `region` is explicitly configured for an AWS Bedrock client, resolve() validates it is non-empty after resolving against the evaluation context. An empty string is rejected because AWS SDK calls cannot proceed without a region.","triggerScenarios":"Setting `region` to a value that resolves to an empty string (e.g. an env-var expression pointing at AWS_REGION which is unset/empty, passed as `region \"${AWS_REGION}\"`).","commonSituations":"CI/CD environments where AWS_REGION is not exported; shell interpolation swallowing a variable; copy-pasting a config with `region \"\"` placeholder.","solutions":["Set a literal region in the config, e.g. `region \"us-east-1\"`.","Ensure AWS_REGION (or AWS_DEFAULT_REGION) is set and non-empty in the environment.","Remove the explicit `region` field entirely and rely on env vars AWS_REGION/AWS_DEFAULT_REGION."],"exampleFix":"// before\noptions {\n  region \"${AWS_REGION}\"\n}\n// after\noptions {\n  region \"us-west-2\"\n}","handlingStrategy":"validation","validationCode":"if let Some(r) = &cfg.region { if r.is_empty() { eprintln!(\"region configured but empty; set AWS_REGION or a literal value\"); } }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Prefer literal region strings over env-var interpolation in shared configs.","Check AWS_REGION/AWS_DEFAULT_REGION are exported in CI images and shells.","Never write `region \"\"` placeholders in committed configs."],"tags":["aws-bedrock","config","empty-value"],"backgroundTag":"empty-required-field","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"}