{"record":{"id":"54419b57230971c3","repo":"grafana/k6","slug":"parsing-page-screenshot-options-w","errorCode":null,"errorMessage":"parsing page screenshot options: %w","messagePattern":"parsing page screenshot options: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/browser/page_mapping.go","lineNumber":424,"sourceCode":"\t\t\tif err := popts.Parse(vu.Context(), opts); err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"parsing page go forward options: %w\", err)\n\t\t\t}\n\t\t\treturn promise(vu, func() (any, error) {\n\t\t\t\tresp, err := p.GoBackForward(+1, popts)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err //nolint:wrapcheck\n\t\t\t\t}\n\t\t\t\tif resp == nil {\n\t\t\t\t\treturn nil, nil //nolint:nilnil\n\t\t\t\t}\n\t\t\t\treturn mapResponse(vu, resp), nil\n\t\t\t}), nil\n\t\t},\n\t\t\"route\": mapPageRoute(vu, p),\n\t\t\"screenshot\": func(opts sobek.Value) (*sobek.Promise, error) {\n\t\t\tpopts, err := parsePageScreenshotOptions(rt, opts)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"parsing page screenshot options: %w\", err)\n\t\t\t}\n\n\t\t\tpromise, res, rej := rt.NewPromise()\n\t\t\tcallback := vu.RegisterCallback()\n\t\t\tgo func() {\n\t\t\t\tbb, err := p.Screenshot(popts, vu.filePersister)\n\t\t\t\tif err != nil {\n\t\t\t\t\tcallback(func() error {\n\t\t\t\t\t\treturn rej(err)\n\t\t\t\t\t})\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tcallback(func() error {\n\t\t\t\t\treturn res(rt.NewArrayBuffer(bb))\n\t\t\t\t})\n\t\t\t}()\n","sourceCodeStart":406,"sourceCodeEnd":442,"githubUrl":"https://github.com/grafana/k6/blob/8d06114777191d21ef885d05c5f8aa9e1ed838ae/internal/js/modules/k6/browser/browser/page_mapping.go#L406-L442","documentation":"Generic parse wrapper for page.screenshot: the options argument failed to decode via parsePageScreenshotOptions into the screenshot options struct (path, type, quality, clip, fullPage, omitBackground...). The wrapped error names the offending key.","triggerScenarios":"Thrown at internal/js/modules/k6/browser/browser/page_mapping.go:423 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the wrapped error for the failing option","Verify types: type 'png'|'jpeg', quality number (jpeg only), clip {x,y,width,height}, fullPage boolean, path string","Compare against screenshot options in the browser module docs"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"8d06114777191d21ef885d05c5f8aa9e1ed838ae","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":"2026-08-18T03:05:52.393Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}