BoundaryML/baml · error

model must be provided

Error message

model must be provided

What it means

AwsBedrock::resolve requires a `model` field on the AWS Bedrock client config. When the config has no model set, resolution aborts with "model must be provided" before any API call is made. This is a fail-fast validation of a required client property.

Solutions

  1. Add a `model` field to your aws-bedrock client config (e.g. `model anthropic.claude-3-sonnet-20240229-v1:0`).
  2. If building the config programmatically, set `model: Some(...)` on the AwsBedrock struct.
  3. If the model is meant to come from context, set it via dynamic client resolution rather than leaving it None.

Example fix

// before
client "MyBedrock" {
  provider "aws-bedrock"
  options {
    region "us-east-1"
  }
}
// after
client "MyBedrock" {
  provider "aws-bedrock"
  options {
    region "us-east-1"
    model "anthropic.claude-3-sonnet-20240229-v1:0"
  }
}
Defensive patterns

Strategy: validation

Validate before calling

// Rust: before resolving an AwsBedrock client
if client.model.as_ref().map_or(true, |m| m.is_empty()) {
    return Err(anyhow::anyhow!("aws-bedrock client requires a `model` option"));
}

Type guard

fn has_model(c: &AwsBedrock) -> bool { c.model.is_some() }

Prevention

When it happens

Trigger: Calling resolve() on an AwsBedrock client-spec whose `model` property is absent (e.g. a BAML client block for aws-bedrock that omits `model`, or a programmatically constructed client with model=None).

Common situations: Writing a bedrock client block in BAML with only region/credentials configured; copying an OpenAI-style client config where model was inferred; typo'ing the model field name so it lands in unknown properties.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


AI-assisted analysis of BoundaryML/baml@bd85ce9dee (2026-09-12). Data as JSON: /api/errors/67f1cb97e2eefda8. Report an issue: GitHub.

Appendix: source

Thrown at engine/baml-lib/llm-client/src/clients/aws_bedrock.rs:251

        }

        match self.endpoint_url.as_ref() {
            Some(endpoint_url) => env_vars.extend(endpoint_url.required_env_vars()),
            None => {}
        }

        env_vars.extend(self.role_selection.required_env_vars());
        env_vars.extend(self.allowed_role_metadata.required_env_vars());
        env_vars.extend(self.supported_request_modes.required_env_vars());
        if let Some(c) = self.inference_config.as_ref() {
            env_vars.extend(c.required_env_vars())
        }
        env_vars
    }

    pub fn resolve(&self, ctx: &EvaluationContext<'_>) -> Result<ResolvedAwsBedrock> {
        let Some(model) = self.model.as_ref() else {
            return Err(anyhow::anyhow!("model must be provided"));
        };

        let role_selection = self.role_selection.resolve(ctx)?;

        let region = match self.region.as_ref() {
            Some(region) => {
                let region = region.resolve(ctx)?;
                if region.is_empty() {
                    return Err(anyhow::anyhow!("region cannot be empty"));
                }
                Some(region)
            }
            None => match ctx.get_env_var("AWS_REGION") {
                Ok(region) if !region.is_empty() => Some(region),
                _ => match ctx.get_env_var("AWS_DEFAULT_REGION") {
                    Ok(region) if !region.is_empty() => Some(region),
                    _ => None,
                },

View on GitHub (pinned to bd85ce9dee)