{"record":{"id":"b6cfc2f6676928b8","repo":"BoundaryML/baml","slug":"decoderawobjectimpl-is-not-set-please-call","errorCode":null,"errorMessage":"decodeRawObjectImpl is not set. Please call SetDecodeRawObjectImpl() before using this function","messagePattern":"decodeRawObjectImpl is not set\\. Please call SetDecodeRawObjectImpl\\(\\) before using this function","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/language_client_go/baml_go/raw_objects/utils.go","lineNumber":248,"sourceCode":"\t\t\tnilType := reflect.TypeOf((*nilObject)(nil)).Elem()\n\t\t\tdecodedValue, goType := serde.Decode(value, serde.NewInternalTypeMap(map[string]reflect.Type{\n\t\t\t\t\"INTERNAL.nil\": nilType,\n\t\t\t}))\n\t\t\tif goType == nilType {\n\t\t\t\treturn nil, nil\n\t\t\t}\n\t\t\treturn decodedValue.Interface(), nil\n\t\tdefault:\n\t\t\tpanic(\"unexpected cffi.isCFFIObjectResponseSuccess_Result\")\n\t\t}\n\tdefault:\n\t\tpanic(\"unexpected cffi.isCFFIObjectResponse_Response\")\n\t}\n}\n\nfunc decodeRawObject(rt unsafe.Pointer, cRaw *cffi.BamlObjectHandle) (RawPointer, error) {\n\tif _decodeRawObjectImpl == nil {\n\t\treturn nil, fmt.Errorf(\"decodeRawObjectImpl is not set. Please call SetDecodeRawObjectImpl() before using this function\")\n\t}\n\n\traw, err := _decodeRawObjectImpl(rt, cRaw)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Log when Go receives an object from Rust\n\tffiLog(\"[CLIENT_GO_RECEIVE] type=%s ptr=0x%x\", raw.ObjectType(), raw.pointer())\n\n\t// on finalization, we need to call the destructor\n\truntime.SetFinalizer(raw, func(r RawPointer) {\n\t\tffiLog(\"[CLIENT_GO_DESTRUCTOR_START] type=%s ptr=0x%x\", r.ObjectType(), r.pointer())\n\t\tif err := destructor(r); err != nil {\n\t\t\t// Always log errors (even if general logging disabled)\n\t\t\tffiLog(\"[CLIENT_GO_DESTRUCTOR_ERROR] type=%s ptr=0x%x error=%v\", r.ObjectType(), r.pointer(), err)\n\t\t} else {\n\t\t\tffiLog(\"[CLIENT_GO_DESTRUCTOR_OK] type=%s ptr=0x%x\", r.ObjectType(), r.pointer())","sourceCodeStart":230,"sourceCodeEnd":266,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/engine/language_client_go/baml_go/raw_objects/utils.go#L230-L266","documentation":"decodeRawObject delegates to a pluggable implementation stored in _decodeRawObjectImpl, which must be registered via SetDecodeRawObjectImpl() during package init. If it is nil, the binding packages that register concrete decoders were never linked into the binary, so object decoding is unavailable.","triggerScenarios":"decodeObjectResponse (via NewRawObject/CallMethod) runs in a binary where no decoder implementation was registered — typically because the required baml_go binding sub-package was not imported.","commonSituations":"Importing only baml_go/raw_objects without the glue package that calls SetDecodeRawObjectImpl (e.g. missing blank import of the runtime package), or upgrading baml_go and dropping a required import.","solutions":["Add the missing import that registers the decoder (e.g. _ \"github.com/boundaryml/baml/engine/language_client_go/baml_go/runtime\" in your main or client package)","Update to a released baml_client entrypoint that performs the registration for you","Ensure SetDecodeRawObjectImpl is called in an init() before any BAML call","Pin/regenerate client code to match your baml_go version"],"exampleFix":"// before\nimport \"github.com/boundaryml/baml/engine/language_client_go/baml_go/raw_objects\"\n// after\nimport (\n  _ \"github.com/boundaryml/baml/engine/language_client_go/baml_go/runtime\"\n  \"github.com/boundaryml/baml/engine/language_client_go/baml_go/raw_objects\"\n)","handlingStrategy":"validation","validationCode":"if baml_decoders.Registered() == false { panic(\"decoder impl not registered: import the baml runtime package\") }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always use the published baml_go client entrypoint which wires SetDecodeRawObjectImpl in init()","Never import baml_go/raw_objects alone; add the blank import of the runtime glue package","Run a smoke test that decodes one object at startup"],"tags":["go","initialization","missing-dependency"],"backgroundTag":"missing-dependency","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"}