Skip to content

[bug] Go: TypeBuilder#AddBaml panics since v0.215.0 #2862

@invakid404

Description

@invakid404

Product

BAML

Describe the bug

When attempting to use .AddBaml on a TypeBuilder instance, BAML panics with the following error:

Decode: holder=&{NullValue:}
panic: reflect: call of reflect.Value.Interface on zero Value

goroutine 1 [running]:
reflect.valueInterface({0x0?, 0x0?, 0x102e26864?}, 0xc?)
	/opt/homebrew/Cellar/go/1.25.5/libexec/src/reflect/value.go:1478 +0xec
reflect.Value.Interface(...)
	/opt/homebrew/Cellar/go/1.25.5/libexec/src/reflect/value.go:1473
github.com/boundaryml/baml/engine/language_client_go/baml_go/raw_objects.decodeObjectResponse(0x14000012308?, 0x6?)
	/Users/inva/go/pkg/mod/github.com/boundaryml/[email protected]/engine/language_client_go/baml_go/raw_objects/utils.go:184 +0x184
github.com/boundaryml/baml/engine/language_client_go/baml_go/raw_objects.CallMethod({0x102f96d08, 0x14000078188}, {0x102e25072, 0x8}, 0x2710?)
	/Users/inva/go/pkg/mod/github.com/boundaryml/[email protected]/engine/language_client_go/baml_go/raw_objects/utils.go:146 +0x2e4
github.com/boundaryml/baml/engine/language_client_go/pkg.(*typeBuilder).AddBaml(0x14000078188, {0x102e344b0, 0x27})
	/Users/inva/go/pkg/mod/github.com/boundaryml/[email protected]/engine/language_client_go/pkg/rawobjects_type_builder.go:222 +0xec
github.com/invakid404/baml-go-type-builder-issue/baml_client/type_builder.(*TypeBuilder).AddBaml(0x102f28660?, {0x102e344b0?, 0x102e24c63?})
	/Users/inva/Coding/baml-go-type-builder-issue/baml_client/type_builder/type_builder.go:156 +0x28
main.main()
	/Users/inva/Coding/baml-go-type-builder-issue/main.go:33 +0x204
exit status 2

Also note the Decode: log present in the output -- it appears 0.215.0 has debug logs of this variety left ungated in the release, they appear everywhere in the logs when calling BAML functions.

Reproduction Steps

Reproducible example: https://github.com/invakid404/baml-go-type-builder-issue

BAML Version

0.215.0

Language/Framework

Go

LLM Provider

None

LLM Model

No response

Operating System

macOS

Browser

None

Code Editor

None

Metadata

Metadata

Assignees

Labels

bugconfirmed by the BAML team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions