{"record":{"id":"c5f29661924745ab","repo":"grafana/k6","slug":"unpacking-scroll-offset-w","errorCode":null,"errorMessage":"unpacking scroll offset: %w","messagePattern":"unpacking scroll offset: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/common/screenshotter.go","lineNumber":351,"sourceCode":"\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"node is either not visible or not an HTMLElement: %w\", err)\n\t\t}\n\t\tif bbox.Width <= 0 {\n\t\t\treturn nil, fmt.Errorf(\"node has 0 width\")\n\t\t}\n\t\tif bbox.Height <= 0 {\n\t\t\treturn nil, fmt.Errorf(\"node has 0 height\")\n\t\t}\n\t}\n\n\tscrollOffset, err := h.Evaluate(`() => { return {x: window.scrollX, y: window.scrollY};}`)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"evaluating scroll offset: %w\", err)\n\t}\n\n\tvar returnVal Position\n\tif err := convert(scrollOffset, &returnVal); err != nil {\n\t\treturn nil, fmt.Errorf(\"unpacking scroll offset: %w\", err)\n\t}\n\n\tdocumentRect := bbox\n\tdocumentRect.X += returnVal.X\n\tdocumentRect.Y += returnVal.Y\n\n\treturn s.screenshot(\n\t\th.frame.page.session,\n\t\tdocumentRect.enclosingIntRect(),\n\t\tnil, // viewportRect\n\t\tformat,\n\t\topts.OmitBackground,\n\t\topts.Quality,\n\t\topts.Path,\n\t)\n}\n\nfunc (s *screenshotter) screenshotPage(p *Page, opts *PageScreenshotOptions) (buf []byte, err error) {","sourceCodeStart":333,"sourceCodeEnd":369,"githubUrl":"https://github.com/grafana/k6/blob/3fcf5388d78cb382f0c0d42ec556a06bfd1b8dee/internal/js/modules/k6/browser/common/screenshotter.go#L333-L369","documentation":"Raised in screenshotElement after the window.scrollX/scrollY evaluation succeeded but its result could not be converted (via the convert helper) into the expected Position struct {X, Y float64}. This is a shape/type mismatch: the CDP Runtime.evaluate result came back in a form (e.g. not a remote object with numeric properties) that cannot be unmarshalled, indicating an unexpected or corrupted evaluation payload rather than a page-level problem.","triggerScenarios":"Thrown at internal/js/modules/k6/browser/common/screenshotter.go:329 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["This is an internal conversion failure; report it as a k6 browser module bug with the page HTML and reproduction script","Update k6 to the latest version where conversion of CDP remote objects may have been fixed","Test with a simpler page to see if a specific page construct triggers the malformed payload"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3fcf5388d78cb382f0c0d42ec556a06bfd1b8dee","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":"2026-08-18T03:05:52.393Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}