{"record":{"id":"bc8901ec42c37fb7","repo":"BoundaryML/baml","slug":"arrow-types-are-not-supported-in-cffi","errorCode":null,"errorMessage":"Arrow types are not supported in CFFI","messagePattern":"Arrow types are not supported in CFFI","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/language_client_cffi/src/ctypes/baml_type_encode.rs","lineNumber":83,"sourceCode":"                value: Some(Box::new(\n                    WithIr {\n                        value,\n                        lookup,\n                        mode,\n                        curr_type,\n                    }\n                    .encode(),\n                )),\n                checks,\n            }))\n        } else {\n            match curr_type {\n                TypeGeneric::Top(_) => panic!(\n                    \"TypeGeneric::Top should have been resolved by the compiler before code generation. \\\n                    This indicates a bug in the type resolution phase.\"\n                ),\n                TypeGeneric::Tuple(_, _) => panic!(\"Tuple types are not supported in CFFI\"),\n                TypeGeneric::Arrow(_, _) => panic!(\"Arrow types are not supported in CFFI\"),\n                TypeGeneric::Primitive(type_value, _) => type_value.encode(),\n                TypeGeneric::Literal(literal_value, _) => cType::LiteralType(literal_value.encode()),\n                TypeGeneric::Enum {\n                    name,\n                    dynamic: _,\n                    meta: _,\n                } => cType::EnumType(CffiFieldTypeEnum { name }),\n                TypeGeneric::Class {\n                    name,\n                    mode,\n                    dynamic: _,\n                    meta: _,\n                } => {\n                    cType::ClassType(CffiFieldTypeClass {\n                        name: Some(create_cffi_type_name(name, match mode {\n                            baml_types::StreamingMode::NonStreaming => CffiTypeNamespace::Types,\n                            baml_types::StreamingMode::Streaming => CffiTypeNamespace::StreamTypes,\n                        })),","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/engine/language_client_cffi/src/ctypes/baml_type_encode.rs#L65-L101","documentation":"Hard capability guard in the CFFI type encoder: the value being encoded carries an Arrow-type IR node, which the CFFI surface cannot represent. The CFFI boundary only supports the non-arrow type universe; reaching this panic means a type that only the newer arrow pipeline understands was handed to the legacy CFFI encoder — an integration mismatch, not user input.","triggerScenarios":"A BAML type tree contains a function/lambda type (e.g. a class field typed as a function) being encoded for the CFFI client runtime.","commonSituations":"Declaring higher-order/functional types in BAML schemas; referencing generated types that embed function signatures into client bindings.","solutions":["Remove the function-typed field/parameter from the BAML schema","Model the behavior as a BAML function called by name rather than a passed function value","Upgrade BAML to check for added FFI support for arrow types"],"exampleFix":"// before\nclass C { handler fn(int) -> string }\n// after\n// register the function as a BAML function and call it instead of storing it in a field","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never declare function/lambda-typed fields in BAML classes","Invoke behavior via named BAML functions instead of passing functions","Keep runtime and schema tooling versions in sync"],"tags":["cffi","unsupported-type","schema"],"backgroundTag":"unsupported-operation","analyzedSha":"bd85ce9dee1463ff04d27efd20531013a4ff46c1","analyzedAt":"2026-09-12T03:38:25.718Z","contentChangedAt":"2026-09-12T03:38:25.718Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}