{"record":{"id":"d0a54a743be28746","repo":"BoundaryML/baml","slug":"failed-to-get-timing-w","errorCode":null,"errorMessage":"failed to get timing: %w","messagePattern":"failed to get timing: %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/language_client_go/pkg/rawobjects_function_log.go","lineNumber":72,"sourceCode":"\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 {\n\t\treturn nil, fmt.Errorf(\"unexpected type for timing: %T\", result)\n\t}\n\n\treturn timing, nil\n}\n\nfunc (f *functionLog) Usage() (Usage, error) {\n\tresult, err := raw_objects.CallMethod(f, \"usage\", nil)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get usage: %w\", err)\n\t}\n\n\tusage, ok := result.(Usage)\n\tif !ok {","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/engine/language_client_go/pkg/rawobjects_function_log.go#L54-L90","documentation":"This error wraps any failure from raw_objects.CallMethod when Timing() fetches the 'timing' attribute of a FunctionLog via the C FFI. It is a pass-through wrapper; the actual cause (empty FFI response buffer, nil pointer, proto unmarshal failure, or object-response decode failure) is in the wrapped error. It means the runtime did not return a usable timing object.","triggerScenarios":"Calling Timing() on a functionLog whose runtime object is invalid or already freed; the FFI call returns an empty buffer; the protobuf InvocationResponse fails to unmarshal or decodeObjectResponse fails.","commonSituations":"Accessing logs after the function stream completed and objects were reclaimed; long-lived services caching log references; Go client vs BAML runtime version mismatch.","solutions":["Unwrap the error to see the underlying FFI failure mode ('failed to call object method function', 'nil pointer', decode failure).","Read Timing() during the lifetime of the owning function call/stream, not afterwards.","Keep the generated Go client and BAML runtime versions in sync (re-run `baml generate`).","Escalate to a bug report if the wrapped error is an unmarshal/decode failure on a live object."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if fnLog == nil {\n    return errors.New(\"function log is nil; cannot read Timing\")\n}","typeGuard":"func isCallMethodFailure(err error) bool {\n    return strings.Contains(err.Error(), \"failed to call object method\")\n}","tryCatchPattern":"timing, err := fnLog.Timing()\nif err != nil {\n    log.Printf(\"Timing unavailable: %v (wrapped: %v)\", err, errors.Unwrap(err))\n    return fmt.Errorf(\"baml timing inaccessible: %w\", err)\n}","preventionTips":["Always unwrap this error to find the underlying FFI failure.","Consume timing data before the stream finishes.","Regenerate the Go client after engine upgrades.","Do not persist raw functionLog pointers across requests."],"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"}