BoundaryML/baml · error · anyhow::Error

{e.message()}

Error message

{e.message()}

What it means

This error is raised while building the IR FunctionConfig for a BAML function: the function's client_spec() could not be resolved, so the compiler bails out with the resolver's error message. It means the function's declared client (or its shorthand provider form) failed to resolve into a concrete client configuration.

Solutions

  1. Check that the client name used by the function matches an entry in the clients { } block in your .baml files
  2. Run baml-cli (or your editor's BAML LSP) validate to see the underlying resolver error message which is embedded in this error
  3. If using a shorthand client (e.g. provider string directly), verify the provider is supported and required args are present
  4. Restore or re-add any deleted client definitions that functions still reference

Example fix

// before
function ExtractResume(text: string) {
  client myClint // typo
  prompt #"..."#
}
// after
function ExtractResume(text: string) {
  client MyClient // matches a defined client
  prompt #"..."#
}
Defensive patterns

Strategy: validation

Validate before calling

// Check the function references a defined client before compile/generation
let defined_clients: HashSet<&str> = baml_src.clients.iter().map(|c| c.name.as_str()).collect();
if !defined_clients.contains(fn_config.client.as_str()) {
    bail!("function {} references unknown client {}", fn_config.name, fn_config.client);
}

Prevention

When it happens

Trigger: Calling IR functions that walk configs when the function references a client that does not exist in the baml_src clients block, or whose provider/target arguments are invalid, so client_spec() returns Err.

Common situations: Typo in the client name referenced by a function, a missing 'clients' block, renaming a client without updating functions, or using a shorthand client spec with an unsupported provider.

Understand the failure class

Background: "missing required config value" errors: why libraries refuse to start when a configuration key is empty, unset, or blank — this error's family across 48 libraries.

Related errors


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

Appendix: source

Thrown at engine/baml-lib/baml-core/src/ir/repr.rs:2772

                .iter()
                .map(|arg| {
                    let field_type = arg.1.field_type.repr(db)?;
                    Ok((arg.0.to_string(), field_type))
                })
                .collect::<Result<Vec<_>>>()?,
            output: self
                .ast_function()
                .output()
                .expect("need block arg")
                .field_type
                .repr(db)?,
            configs: vec![FunctionConfig {
                name: "default_config".to_string(),
                prompt_template: self.jinja_prompt().to_string(),
                prompt_span: self.ast_function().span().clone(),
                client: match self.client_spec() {
                    Ok(spec) => spec,
                    Err(e) => anyhow::bail!("{}", e.message()),
                },
            }],
            default_config: "default_config".to_string(),
            tests: self
                .walk_tests()
                .map(|e| e.node(db))
                .collect::<Result<Vec<_>>>()?,
        })
    }
}

type ClientId = String;

#[derive(Debug)]
pub struct Client {
    pub name: ClientId,
    pub provider: ClientProvider,
    pub retry_policy_id: Option<String>,

View on GitHub (pinned to bd85ce9dee)