BoundaryML/baml · error
Tuple types are not supported in CFFI
Error message
Tuple types are not supported in CFFI
What it means
The CFFI layer encodes BAML types for cross-language FFI. Tuple types (TypeGeneric::Tuple) cannot be represented in the C FFI type encoding, so encoding panics with this message. It is a hard unsupported-feature abort, not a recoverable error.
Source
Thrown at engine/language_client_cffi/src/ctypes/baml_type_encode.rs:82
cType::CheckedType(Box::new(CffiFieldTypeChecked {
value: Some(Box::new(
WithIr {
value,
lookup,
mode,
curr_type,
}
.encode(),
)),
checks,
}))
} else {
match curr_type {
TypeGeneric::Top(_) => panic!(
"TypeGeneric::Top should have been resolved by the compiler before code generation. \
This indicates a bug in the type resolution phase."
),
TypeGeneric::Tuple(_, _) => panic!("Tuple types are not supported in CFFI"),
TypeGeneric::Arrow(_, _) => panic!("Arrow types are not supported in CFFI"),
TypeGeneric::Primitive(type_value, _) => type_value.encode(),
TypeGeneric::Literal(literal_value, _) => cType::LiteralType(literal_value.encode()),
TypeGeneric::Enum {
name,
dynamic: _,
meta: _,
} => cType::EnumType(CffiFieldTypeEnum { name }),
TypeGeneric::Class {
name,
mode,
dynamic: _,
meta: _,
} => {
cType::ClassType(CffiFieldTypeClass {
name: Some(create_cffi_type_name(name, match mode {
baml_types::StreamingMode::NonStreaming => CffiTypeNamespace::Types,
baml_types::StreamingMode::Streaming => CffiTypeNamespace::StreamTypes,View on GitHub (pinned to bd85ce9dee)
Solutions
- Replace the tuple type in your BAML schema with a class or a list of a single type
- Use a generic list (e.g. `string[]`) or a dedicated class with named fields instead of a tuple
- Upgrade BAML — check whether newer versions added CFFI tuple support
Example fix
// before (schema.baml)
class Result { coords (int, int) }
// after
class Coords { x int
y int }
class Result { coords Coords } Defensive patterns
Strategy: validation
Validate before calling
# scan schema for tuple types before loading via CFFI
import re
schema = open('schema.baml').read()
if re.search(r'\([^)]*\bint|string|bool|float\b[^)]*\)', schema):
raise ValueError('possible tuple type in BAML schema — unsupported in CFFI') Prevention
- Model structured data as classes, not tuples, in BAML schemas
- Keep schema types limited to primitives, lists, maps, enums, classes
- Upgrade BAML to check for new type support
When it happens
Trigger: A BAML schema (class field, function argument/return type) uses a tuple type (e.g. `(int, string)`) and is compiled/loaded through the language_client_cffi runtime.
Common situations: Defining tuple types in a BAML file for a client language bound via CFFI (e.g. Python ctypes build); copying schemas that used tuple types allowed in other backends.
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
- Arrow types are not supported in CFFI
- Type '{0}' is not supported in outputs
- `{}` is not a BAML source file. Use a `.baml` file with `--f
- manifest schema {got} not supported (max {max}); run `baml s
- manifest schema {schema} is newer than this wrapper; run `ba
AI-assisted analysis of BoundaryML/baml@bd85ce9dee (2026-09-12).
Data as JSON: /api/errors/acf79eda257cccdc.
Report an issue: GitHub.