{"record":{"id":"3d87e985a77c3c35","repo":"JuliusBrussee/caveman","slug":"browser-returned-no-result-object","errorCode":null,"errorMessage":"browser returned no result object","messagePattern":"browser returned no result object","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"browse/cdp.go","lineNumber":386,"sourceCode":"\t_, err := d.callOnNodeRaw(ctx, target, fn)\n\treturn err\n}\n\nfunc (d *CDPDriver) callBoolOnNode(ctx context.Context, target Target, fn string) (bool, error) {\n\tres, err := d.callOnNodeRaw(ctx, target, fn)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\treturn decodeBoolObject(res)\n}\n\n// decodeBoolObject reads a boolean out of a CallFunctionOn result, failing\n// closed on a nil object. CallFunctionOn can return a nil RemoteObject without\n// an error; dereferencing res.Value there would nil-panic and, through the MCP\n// panic hole, kill the whole process (issue #140).\nfunc decodeBoolObject(res *runtime.RemoteObject) (bool, error) {\n\tif res == nil {\n\t\treturn false, errors.New(\"browser returned no result object\")\n\t}\n\tvar out bool\n\tif err := json.Unmarshal(res.Value, &out); err != nil {\n\t\treturn false, err\n\t}\n\treturn out, nil\n}\n\nfunc (d *CDPDriver) callOnNodeRaw(ctx context.Context, target Target, fn string) (*runtime.RemoteObject, error) {\n\tif target.BackendDOMNodeID <= 0 {\n\t\treturn nil, errors.New(\"missing backend DOM node id\")\n\t}\n\tvar res *runtime.RemoteObject\n\tvar exception *runtime.ExceptionDetails\n\tif err := chromedp.Run(ctx, chromedp.ActionFunc(func(actionCtx context.Context) error {\n\t\tobj, err := dom.ResolveNode().WithBackendNodeID(cdp.BackendNodeID(target.BackendDOMNodeID)).Do(actionCtx)\n\t\tif err != nil {\n\t\t\treturn err","sourceCodeStart":368,"sourceCodeEnd":404,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/27d5a3981a347890211bb1bf2439e5c821a63bc9/browse/cdp.go#L368-L404","documentation":"Returned by decodeBoolObject() when a runtime.CallFunctionOn result is a nil *runtime.RemoteObject. Per the code comment, CallFunctionOn can return nil without an error; dereferencing res.Value there would nil-panic and — through the MCP panic hole — kill the whole process (issue #140). So the helper fails closed with this error instead of crashing.","triggerScenarios":"Any boolean-returning callOnNode evaluation (actionability checks, visibility predicates) where Chrome returns no remote object: target detached mid-call, execution context destroyed by navigation, or the evaluated function returning undefined.","commonSituations":"Page navigates or redirects while an actionability check runs; SPA route change destroying the frame's context; element removed by a script between snapshot and act.","solutions":["Retry the action after a fresh snapshot — a destroyed context is usually transient and the new handle re-resolves.","If it reproduces on one element consistently, the element's frame/context is being torn down (redirect loop, aggressive rerender); stabilize the page state first.","Do not 'handle' it by ignoring the error: it is deliberately failing closed where older code would have panic-killed the MCP server."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Go: fail closed on nil RemoteObject instead of dereferencing\nres, err := d.callOnNodeRaw(ctx, target, fn)\nif err != nil {\n    if strings.Contains(err.Error(), \"no result object\") {\n        // context likely destroyed: re-snapshot once, then give up cleanly\n        return retryAfterSnapshot(ctx, target, fn)\n    }\n    return false, err\n}","preventionTips":["Always nil-check *runtime.RemoteObject before reading .Value — CallFunctionOn can return nil without error (issue #140).","Re-snapshot and retry once on nil-result errors; treat repeat failures as page instability, not transient noise.","Never convert this error into a default boolean — it exists to stop a panic that killed the MCP process."],"tags":["browser","cdp","nil-safety","race","mcp"],"backgroundTag":null,"analyzedSha":"27d5a3981a347890211bb1bf2439e5c821a63bc9","analyzedAt":"2026-08-15T09:26:11.751Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}