-
Notifications
You must be signed in to change notification settings - Fork 358
Open
Description
Product
BAML
Describe the bug
Basically, the title.
If a union field is added to a dynamic class via the type builder, BAML panics when deserializing it:
panic: reflect: call of reflect.Value.Elem on struct Value
goroutine 17 [running, locked to thread]:
reflect.Value.Elem({0x101337a80?, 0x140002119e0?, 0x140000bd350?})
/opt/homebrew/Cellar/go/1.25.5/libexec/src/reflect/value.go:1254 +0x184
github.com/boundaryml/baml/engine/language_client_go/baml_go/serde.decodeUnionValue.func1(...)
/Users/inva/go/pkg/mod/github.com/boundaryml/[email protected]/engine/language_client_go/baml_go/serde/decode.go:230
github.com/boundaryml/baml/engine/language_client_go/baml_go/serde.decodeUnionValue(0x140002260c0, {0x13?, 0x140000bd350?})
/Users/inva/go/pkg/mod/github.com/boundaryml/[email protected]/engine/language_client_go/baml_go/serde/decode.go:242 +0x120
github.com/boundaryml/baml/engine/language_client_go/baml_go/serde.Decode(0x1400020a180, {0x1?, 0x140000bd350?})
/Users/inva/go/pkg/mod/github.com/boundaryml/[email protected]/engine/language_client_go/baml_go/serde/decode.go:557 +0x16c
github.com/boundaryml/baml/engine/language_client_go/pkg.DecodeToValue(0x1012cd740?)
/Users/inva/go/pkg/mod/github.com/boundaryml/[email protected]/engine/language_client_go/pkg/lib.go:29 +0x2c
github.com/invakid404/baml-union-panic-reproduction/baml_client/types.(*Response).Decode(0x1400021c720, 0x1400020e000, {0xc0?, 0x101292760?})
/Users/inva/Coding/baml-union-panic-reproduction/baml_client/types/classes.go:157 +0x168
github.com/boundaryml/baml/engine/language_client_go/baml_go/serde.decodeClassValue(0x1400020e000, {0x13?, 0x140000bd350?})
/Users/inva/go/pkg/mod/github.com/boundaryml/[email protected]/engine/language_client_go/baml_go/serde/decode.go:186 +0x198
github.com/boundaryml/baml/engine/language_client_go/baml_go/serde.Decode(0x1400020a000, {0xbd?, 0x140000bd350?})
/Users/inva/go/pkg/mod/github.com/boundaryml/[email protected]/engine/language_client_go/baml_go/serde/decode.go:549 +0x10c
github.com/boundaryml/baml/engine/language_client_go/pkg.trigger_callback(0x4f325, 0x1, 0x89d150180, 0xbd)
/Users/inva/go/pkg/mod/github.com/boundaryml/[email protected]/engine/language_client_go/pkg/callbacks.go:137 +0x1e4
exit status 2
Reproduction Steps
Reproduction repo: https://github.com/invakid404/baml-union-panic-reproduction
BAML Version
0.217.0
Language/Framework
Go
LLM Provider
Other
LLM Model
Not relevant
Operating System
macOS
Browser
None
Code Editor
None
Metadata
Metadata
Assignees
Labels
No labels