{"record":{"id":"ce25a04611841729","repo":"JuliusBrussee/caveman","slug":"box-model-has-no-quad","errorCode":null,"errorMessage":"box model has no quad","messagePattern":"box model has no quad","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"browse/cdp.go","lineNumber":318,"sourceCode":"\nfunc (d *CDPDriver) box(ctx context.Context, target Target) (float64, float64, float64, float64, error) {\n\tif target.BackendDOMNodeID <= 0 {\n\t\treturn 0, 0, 0, 0, errors.New(\"missing backend DOM node id\")\n\t}\n\tvar model *dom.BoxModel\n\tif err := chromedp.Run(ctx, chromedp.ActionFunc(func(actionCtx context.Context) error {\n\t\tvar err error\n\t\tmodel, err = dom.GetBoxModel().WithBackendNodeID(cdp.BackendNodeID(target.BackendDOMNodeID)).Do(actionCtx)\n\t\treturn err\n\t})); err != nil {\n\t\treturn 0, 0, 0, 0, err\n\t}\n\tquad := model.Content\n\tif len(quad) < 8 {\n\t\tquad = model.Border\n\t}\n\tif len(quad) < 8 {\n\t\treturn 0, 0, 0, 0, errors.New(\"box model has no quad\")\n\t}\n\tminX, maxX := quad[0], quad[0]\n\tminY, maxY := quad[1], quad[1]\n\tfor i := 0; i+1 < len(quad); i += 2 {\n\t\tminX = math.Min(minX, quad[i])\n\t\tmaxX = math.Max(maxX, quad[i])\n\t\tminY = math.Min(minY, quad[i+1])\n\t\tmaxY = math.Max(maxY, quad[i+1])\n\t}\n\treturn (minX + maxX) / 2, (minY + maxY) / 2, maxX - minX, maxY - minY, nil\n}\n\nfunc (d *CDPDriver) visible(ctx context.Context, target Target) (bool, error) {\n\treturn d.callBoolOnNode(ctx, target, `function(){ const s = window.getComputedStyle(this); const r = this.getBoundingClientRect(); return !!s && s.display !== \"none\" && s.visibility !== \"hidden\" && s.pointerEvents !== \"none\" && Number(s.opacity || \"1\") > 0 && r.width > 0 && r.height > 0; }`)\n}\n\nfunc (d *CDPDriver) enabled(ctx context.Context, target Target) (bool, error) {\n\treturn d.callBoolOnNode(ctx, target, `function(){ return !(this.disabled === true || this.getAttribute(\"disabled\") !== null || this.getAttribute(\"aria-disabled\") === \"true\" || this.closest(\"[inert]\")); }`)","sourceCodeStart":300,"sourceCodeEnd":336,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/27d5a3981a347890211bb1bf2439e5c821a63bc9/browse/cdp.go#L300-L336","documentation":"Returned by CDPDriver.box() when the fetched dom.BoxModel has fewer than 8 numbers in both its Content quad and its Border quad (a quad is 4 corner points x,y = 8 floats). The driver tries Content first, falls back to Border, then fails: without a quad there is no geometry to compute a click point or bounds from. Happens with elements Chrome reports as displayed:none or detached from layout.","triggerScenarios":"Requesting geometry for an element that has no layout box: display:none, inside a closed <details>/hidden container, an option element not rendered, or a node removed from the DOM between the actionable check and the GetBoxModel call.","commonSituations":"Acting on collapsed accordions/tabs whose contents exist in the AX tree but have no rendered box; racing a re-render that briefly detaches the node; hidden <select> options styled away.","solutions":["Make the element actually visible first (expand the section, unhide the container), re-snapshot, then act.","Retry once after a re-snapshot — if the node was mid-detach during a re-render the new handle usually has a box.","If the element is inherently box-less (e.g. an <option>), act on it via the select action rather than coordinate-based clicks."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Go: verify the element renders a box before coordinate-dependent action\nfunc hasVisibleBox(driver Driver, ctx context.Context, t Target) bool {\n    _, _, w, h, err := driver.Box(ctx, t)\n    return err == nil && w > 0 && h > 0\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Expand/unhide containers (accordions, tabs) and re-snapshot before acting on their contents.","Use the select action for <option> elements instead of coordinate clicks — options often have no box.","Retry once after a re-snapshot when a re-render race is suspected."],"tags":["browser","cdp","layout","dom"],"backgroundTag":null,"analyzedSha":"27d5a3981a347890211bb1bf2439e5c821a63bc9","analyzedAt":"2026-08-15T09:26:11.751Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}