{"record":{"id":"1b855cf36a392ebc","repo":"BoundaryML/baml","slug":"failed-to-get-log-by-id-w","errorCode":null,"errorMessage":"failed to get log by id: %w","messagePattern":"failed to get log by id: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/language_client_go/pkg/rawobjects_collector.go","lineNumber":101,"sourceCode":"\n\tif result == nil {\n\t\treturn nil, nil\n\t}\n\n\tlog, ok := result.(FunctionLog)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"unexpected type for last log: %T %v\", result, result)\n\t}\n\n\treturn log, nil\n}\n\nfunc (c *collector) Id(functionId string) (FunctionLog, error) {\n\tresult, err := raw_objects.CallMethod(c, \"id\", map[string]any{\n\t\t\"id\": functionId,\n\t})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get log by id: %w\", err)\n\t}\n\n\tlog, ok := result.(FunctionLog)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"unexpected type for log by id: %T\", result)\n\t}\n\n\treturn log, nil\n}\n\nfunc (c *collector) Clear() (int64, error) {\n\tresult, err := raw_objects.CallMethod(c, \"clear\", nil)\n\tif err != nil {\n\t\treturn 0, fmt.Errorf(\"failed to clear: %w\", err)\n\t}\n\n\tcount, ok := result.(int64)\n\tif !ok {","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/engine/language_client_go/pkg/rawobjects_collector.go#L83-L119","documentation":"Go raw-objects collector error: the cross-language CallMethod('id') used to fetch a function log by ID returned an error from the underlying runtime. The %w wraps the RPC/bridge failure itself (unknown id, runtime error); it fires before the result type-assertion, so it is not a Go-side type problem.","triggerScenarios":"collector.Id(functionId) where the runtime rejects the lookup — unknown/unregistered function id, stale collector handle, or runtime-side error during the call.","commonSituations":"Querying a function id that never logged in this collector; typos in the function id; using a collector from a different runtime session.","solutions":["Verify the functionId actually ran and was tracked by this collector.","Check the wrapped error for a runtime-side not-found vs FFI failure.","List available logs via collector.Logs() to find valid ids.","Ensure the runtime that owns the collector is still alive."],"exampleFix":"// before\nlog, _ := collector.Id(fnId)\n// after\nlog, err := collector.Id(fnId)\nif err != nil {\n\treturn fmt.Errorf(\"lookup %q failed: %w\", fnId, err)\n}","handlingStrategy":"validation","validationCode":"if functionId == \"\" { return errors.New(\"functionId required\") }\nlogs, _ := collector.Logs()\nfound := false\nfor _, l := range logs { if l.Id() == functionId { found = true } }\nif !found { return fmt.Errorf(\"function %q not tracked by this collector\", functionId) }","typeGuard":null,"tryCatchPattern":"log, err := collector.Id(functionId)\nif err != nil {\n\treturn fmt.Errorf(\"no log for function %q: %w\", functionId, err)\n}","preventionTips":["Verify the function id exists in collector.Logs() before Id().","Avoid ids from a different runtime session or collector.","Handle both not-found and FFI failure branches."],"tags":["go","ffi","collector","lookup"],"backgroundTag":"record-not-found","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"}