{"record":{"id":"59cf54aa29d77703","repo":"BoundaryML/baml","slug":"unexpected-type-from-source-t","errorCode":null,"errorMessage":"unexpected type from source: %T","messagePattern":"unexpected type from source: %T","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/language_client_go/pkg/rawobjects_llmrenderable.go","lineNumber":77,"sourceCode":"\t}\n\n\talias, ok := result.(string)\n\tif !ok {\n\t\treturn nil, nil\n\t}\n\n\treturn &alias, nil\n}\n\nfunc (eb *llmRenderableObject) From() (ASTNodeSource, error) {\n\tresult, err := raw_objects.CallMethod(eb, \"is_from_ast\", nil)\n\tif err != nil {\n\t\treturn ASTNodeSource_Unknown, err\n\t}\n\n\tfromSource, ok := result.(bool)\n\tif !ok {\n\t\treturn ASTNodeSource_Unknown, fmt.Errorf(\"unexpected type from source: %T\", result)\n\t}\n\n\tif fromSource {\n\t\treturn ASTNodeSource_Baml, nil\n\t}\n\n\treturn ASTNodeSource_TypeBuilder, nil\n}\n\nfunc (eb *llmRenderableObject) Name() (string, error) {\n\tresult, err := raw_objects.CallMethod(eb, \"name\", nil)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tname, ok := result.(string)\n\tif !ok {\n\t\treturn \"\", fmt.Errorf(\"unexpected type from source: %T\", result)","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/engine/language_client_go/pkg/rawobjects_llmrenderable.go#L59-L95","documentation":"The llmRenderable From() helper asks the native runtime whether the AST node came from source via the \"from_source\" method, expecting a bool. If the deserialized result is not a bool, it returns \"unexpected type from source: %T\" with ASTNodeSource_Unknown. The message text is also (confusingly) reused by Name() below.","triggerScenarios":"Calling From() on a renderable whose native \"from_source\" returns nil or a non-bool, typically due to runtime/binding version skew or an invalidated native object.","commonSituations":"Introspecting AST nodes from a baml runtime compiled with a different protocol than the Go client; nodes that never resolved to a source file.","solutions":["Align the generated Go client with the native runtime version","Re-acquire the renderable from a fresh BAML runtime instance","If the error persists on valid nodes, file a binding bug with the %T value"],"exampleFix":"// before\nsrc, err := bamlRenderable.From()\n// after\nsrc, err := bamlRenderable.From()\nif err != nil {\n    return ASTNodeSource_Unknown // caller already receives Unknown; log and degrade\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Go\nsrc, err := renderable.From()\nif err != nil {\n    return ASTNodeSource_Unknown // From() already returns Unknown on error\n}","preventionTips":["Regenerate the Go client whenever the native runtime is upgraded","Acquire renderables from the same runtime instance you query them on","Note From() returns ASTNodeSource_Unknown on this error — check err, not just the enum"],"tags":["go","ffi","ast","type-mismatch"],"backgroundTag":"type-mismatch","analyzedSha":"bd85ce9dee1463ff04d27efd20531013a4ff46c1","analyzedAt":"2026-09-12T03:38:25.718Z","contentChangedAt":"2026-09-12T03:38:25.718Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}