{"record":{"id":"b43837addf8b946c","repo":"BoundaryML/baml","slug":"failed-to-get-log-type-w","errorCode":null,"errorMessage":"failed to get log type: %w","messagePattern":"failed to get log type: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/language_client_go/pkg/rawobjects_function_log.go","lineNumber":58,"sourceCode":"\nfunc (f *functionLog) FunctionName() (string, error) {\n\tresult, err := raw_objects.CallMethod(f, \"function_name\", nil)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to get function name: %w\", err)\n\t}\n\n\tname, ok := result.(string)\n\tif !ok {\n\t\treturn \"\", fmt.Errorf(\"unexpected type for function name: %T\", result)\n\t}\n\n\treturn name, nil\n}\n\nfunc (f *functionLog) LogType() (string, error) {\n\tresult, err := raw_objects.CallMethod(f, \"log_type\", nil)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to get log type: %w\", err)\n\t}\n\n\tlogType, ok := result.(string)\n\tif !ok {\n\t\treturn \"\", fmt.Errorf(\"unexpected type for log type: %T\", result)\n\t}\n\n\treturn logType, nil\n}\n\nfunc (f *functionLog) Timing() (Timing, error) {\n\tresult, err := raw_objects.CallMethod(f, \"timing\", nil)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get timing: %w\", err)\n\t}\n\n\ttiming, ok := result.(Timing)\n\tif !ok {","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/engine/language_client_go/pkg/rawobjects_function_log.go#L40-L76","documentation":"This error wraps any failure from raw_objects.CallMethod when LogType() requests the 'log_type' attribute of a FunctionLog over the C FFI. It is a wrapper: the actionable cause (empty FFI buffer, nil pointer, proto unmarshal error, or object-response decode failure) is carried in the wrapped error. It signals the Go client could not retrieve this property from the runtime object at all.","triggerScenarios":"Calling LogType() when the underlying function-log runtime object is stale/destroyed, the FFI method call returns an empty buffer, or the protobuf response fails to unmarshal/decode.","commonSituations":"Using a FunctionLog obtained from a completed stream after cleanup; holding collector logs across process boundaries; version mismatch between generated Go client and BAML runtime.","solutions":["Inspect the wrapped error (errors.Unwrap) to distinguish 'failed to call object method function', 'returned nil pointer', or decode failures.","Access the log within the lifetime of its owning function call/stream; do not cache log objects past the stream end.","Re-run `baml generate` to keep the Go client in sync with the BAML runtime version.","Report persistent decode/unmarshal failures upstream with your client and runtime versions."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if fnLog == nil {\n    return errors.New(\"function log is nil; cannot read LogType\")\n}","typeGuard":"func isCallMethodFailure(err error) bool {\n    return strings.Contains(err.Error(), \"failed to call object method\")\n}","tryCatchPattern":"lt, err := fnLog.LogType()\nif err != nil {\n    log.Printf(\"LogType unavailable: %v (wrapped: %v)\", err, errors.Unwrap(err))\n    return fmt.Errorf(\"baml function log inaccessible: %w\", err)\n}","preventionTips":["Inspect errors.Unwrap — the root FFI cause is in the wrapped error.","Read LogType within the stream's lifetime.","Regenerate the client after BAML runtime upgrades.","Avoid caching functionLog references in long-lived services."],"tags":["go","ffi","wrapped-error","baml"],"backgroundTag":"unexpected-response-shape","analyzedSha":"bd85ce9dee1463ff04d27efd20531013a4ff46c1","analyzedAt":"2026-09-12T03:38:25.718Z","contentChangedAt":"2026-09-12T03:38:25.718Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}