BoundaryML/baml · error

unkown function

Error message

unkown function: {}

What it means

BAML's VM only supports `baml.fetch_as` for network futures, but a Net-kind future was scheduled with a different function name. The runtime intentionally rejects it instead of dispatching to an unimplemented builtin. The message is a misspelling of 'unknown function: <name>'.

Solutions

  1. Rename the call to `baml.fetch_as` in the BAML code, which is the only supported network function
  2. Check the installed BAML runtime version's supported builtins and upgrade if `baml.fetch_as` alternatives were added later
  3. Fix typos in the function name inside the .baml source
  4. If a custom builtin was intended, remove or gate the call behind a feature the VM implements

Example fix

// before (BAML)
let raw = baml.fetch("https://api.example.com/data")
// after
let raw = baml.fetch_as("https://api.example.com/data", MyType)
Defensive patterns

Strategy: validation

Validate before calling

// before executing BAML code, scan its source for unsupported net builtins
function validateNetFunctions(bamlSrc) {
  const calls = [...bamlSrc.matchAll(/baml\.(\w+)\s*\(/g)].map(m => m[1]);
  const bad = calls.filter(n => n !== 'fetch_as');
  if (bad.length) throw new Error(`Unsupported baml.* functions: ${[...new Set(bad)].join(', ')}. Only baml.fetch_as is supported.`);
}

Type guard

function isSupportedNetCall(name) { return name === 'baml.fetch_as'; }

Prevention

When it happens

Trigger: Calling any network builtin other than baml.fetch_as (e.g. baml.fetch, http.get) inside BAML code executed via the async VM, so a FutureKind::Net future resolves to an unsupported function name.

Common situations: Using an older or newer BAML dialect that exposes other net functions, typo-ing `baml.fetch_as` (e.g. `baml.fetch`), or porting BAML snippets that rely on features not implemented in this runtime 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/e828bc2cf6e57e38. Report an issue: GitHub.

Appendix: source

Thrown at engine/baml-runtime/src/async_vm_runtime.rs:525

                            //
                            // The only difference is that the returned task JoinHandle
                            // is itself !Send, which means it can't be awaited from
                            // other threads.
                            //
                            // But it does not matter because in WASM we're not gonna
                            // await the task from another thread, wasm-bindgen-futures
                            // basically turns Rust futures into JavaScript promises,
                            // which are supposed to be single threaded. So, on WASM,
                            // except for compilation required types, spawn and
                            // spawn_local are essentially equivalent.
                            #[cfg(target_arch = "wasm32")]
                            wasm_bindgen_futures::spawn_local(future);
                        }

                        baml_vm::FutureKind::Net => {
                            // Only `baml.fetch_as` is supported for now.
                            if pending_future.function != "baml.fetch_as" {
                                break 'mainloop Err(anyhow!(
                                    "unkown function: {}",
                                    pending_future.function
                                ));
                            }

                            if pending_future.args.len() != 2 {
                                break 'mainloop Err(anyhow!(
                                    "expected 2 arguments for `baml.fetch_as`, got {}",
                                    pending_future.args.len()
                                ));
                            }

                            let url_or_request =
                                match try_baml_value_from_vm_value(&vm, &pending_future.args[0]) {
                                    Ok(url_or_request) => url_or_request,
                                    Err(e) => {
                                        break 'mainloop Err(e.context(
                                        "baml.fetch_as: failed to get url or request from VM value",

View on GitHub (pinned to bd85ce9dee)