BoundaryML/baml · error

Unsupported

Error message

Unsupported {} `{}`: {}

What it means

The error_unsupported! macro reports a construct the compiler/IR does not support, formatted 'Unsupported TYPE `NAME`: REASON'. Unlike not-found errors, the entity exists but some feature or shape of it is rejected (e.g. an unsupported type usage, feature, or expression).

Solutions

  1. Read the REASON in the message and replace the unsupported construct with a supported equivalent
  2. Upgrade the BAML compiler/generator to a version supporting the feature
  3. Simplify the type expression (e.g. replace exotic generics with a named class)
  4. Check release notes for the feature's availability

Example fix

// before
function F() -> map<string, list<map<string, int>>>
// after
class Nested { counts map<string, int> }
function F() -> map<string, Nested>
Defensive patterns

Strategy: try-catch

Try / catch

match result {
  Err(e) if e.to_string().starts_with("Unsupported") => {
    // surface the reason to the user; do not retry
    report_unsupported_construct(&e);
  }
  other => other?,
}

Prevention

When it happens

Trigger: Calling error_unsupported!("type", name, reason) during IR resolution when a declared construct uses an unsupported feature — e.g. unsupported generic usage or a type expression the backend cannot represent.

Common situations: Using a newer/experimental .baml language feature with an older compiler; attempting type constructs not implemented for a target language's client codegen; copying patterns from docs targeting a different BAML version.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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

Appendix: source

Thrown at engine/baml-lib/baml-core/src/ir/ir_helpers/error_utils.rs:84

                )
            }
            _ => {
                let suggestions = suggestions.join(", ");
                anyhow::bail!(
                    "{} `{}` not found. Did you mean one of: {}?",
                    $type,
                    $name,
                    suggestions
                )
            }
        }
    }};
}

#[macro_export]
macro_rules! error_unsupported {
    ($type:expr, $name:expr, $reason:expr) => {
        anyhow::bail!("Unsupported {} `{}`: {}", $type, $name, $reason)
    };
}

View on GitHub (pinned to bd85ce9dee)