{"record":{"id":"b8b46950273d7acb","repo":"BoundaryML/baml","slug":"unexpected-cffi-iscffifieldtypeliteral-literal-v","errorCode":null,"errorMessage":"unexpected cffi.isCFFIFieldTypeLiteral_Literal: %#v","messagePattern":"unexpected cffi\\.isCFFIFieldTypeLiteral_Literal: %#v","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"engine/language_client_go/baml_go/serde/decode.go","lineNumber":361,"sourceCode":"\tif _, ok := type_.(*cffi.CFFIFieldTypeHolder_IntType); ok {\n\t\treturn reflect.TypeOf(int64(0))\n\t}\n\n\tif _, ok := type_.(*cffi.CFFIFieldTypeHolder_FloatType); ok {\n\t\treturn reflect.TypeOf(float64(0))\n\t}\n\n\tif literal, ok := type_.(*cffi.CFFIFieldTypeHolder_LiteralType); ok {\n\t\tliteralType := literal.LiteralType\n\t\tswitch literalType.Literal.(type) {\n\t\tcase *cffi.CFFIFieldTypeLiteral_BoolLiteral:\n\t\t\treturn reflect.TypeOf(false)\n\t\tcase *cffi.CFFIFieldTypeLiteral_IntLiteral:\n\t\t\treturn reflect.TypeOf(int64(0))\n\t\tcase *cffi.CFFIFieldTypeLiteral_StringLiteral:\n\t\t\treturn reflect.TypeOf(\"\")\n\t\tdefault:\n\t\t\tpanic(fmt.Sprintf(\"unexpected cffi.isCFFIFieldTypeLiteral_Literal: %#v\", literalType.Literal))\n\t\t}\n\t}\n\n\tif class, ok := type_.(*cffi.CFFIFieldTypeHolder_ClassType); ok {\n\t\tname := class.ClassType.Name.Name\n\t\tgoType, ok := typeMap.GetType(class.ClassType.Name)\n\t\tif !ok {\n\t\t\t// going to be a dynamic class\n\t\t\treturn reflect.TypeOf(DynamicClass{\n\t\t\t\tName: name,\n\t\t\t})\n\t\t}\n\t\treturn goType\n\t}\n\n\tif enum, ok := type_.(*cffi.CFFIFieldTypeHolder_EnumType); ok {\n\t\tname := enum.EnumType.Name\n\t\tnamespace := cffi.CFFITypeNamespace_TYPES.String()","sourceCodeStart":343,"sourceCodeEnd":379,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/engine/language_client_go/baml_go/serde/decode.go#L343-L379","documentation":"When a CFFI field type is a literal, the decoder only recognizes Bool, Int, and String literals; any other literal variant hits the default branch and panics with the offending value dumped via %#v. This means the runtime emitted a literal field type the compiled Go bindings do not know.","triggerScenarios":"convertFieldTypeToGoType encounters a CFFIFieldTypeLiteral whose Literal variant is new or unexpected relative to the compiled bindings — typically after a runtime upgrade introduced a new literal kind (e.g. float literals).","commonSituations":"BAML runtime updated ahead of Go bindings; using a schema feature (new literal type) unsupported by the installed client version.","solutions":["Upgrade baml_go bindings and regenerate baml_client so both support the literal type","Rebuild the Go binary after upgrading","Temporarily replace the unsupported literal in the .baml schema with a plain type","Report the %#v payload to BAML maintainers if versions already match"],"exampleFix":"// before (schema using unsupported literal on old client)\ntype Foo string\n// after: upgrade bindings, then\n// baml-cli generate && go build ./...","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"func knownLiteral(l cffi.IsCFFIFieldTypeLiteral_Literal) bool {\n  switch l.(type) { case *cffi.CFFIFieldTypeLiteral_BoolLiteral, *cffi.CFFIFieldTypeLiteral_IntLiteral, *cffi.CFFIFieldTypeLiteral_StringLiteral: return true }\n  return false\n}","tryCatchPattern":"defer func() { if r := recover(); r != nil { return fmt.Errorf(\"unsupported literal type: %v\", r) } }()","preventionTips":["Keep baml_go bindings at the same version as the BAML CLI that generated the client","Avoid new literal-type schema features until bindings support them","Add recover() around serde conversion of schema-derived types"],"tags":["go","panic","types","enum"],"backgroundTag":"unsupported-enum-value","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"}