{"record":{"id":"3c22e4680aea0ffe","repo":"grafana/k6","slug":"parsing-grant-permission-options-w","errorCode":null,"errorMessage":"parsing grant permission options: %w","messagePattern":"parsing grant permission options: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/browser/browser_context_mapping.go","lineNumber":86,"sourceCode":"\t\t\"clearPermissions\": func() *sobek.Promise {\n\t\t\treturn promise(vu, func() (any, error) {\n\t\t\t\treturn nil, bc.ClearPermissions() //nolint:wrapcheck\n\t\t\t})\n\t\t},\n\t\t\"close\": func() *sobek.Promise {\n\t\t\treturn promise(vu, func() (any, error) {\n\t\t\t\treturn nil, bc.Close() //nolint:wrapcheck\n\t\t\t})\n\t\t},\n\t\t\"cookies\": func(urls ...string) *sobek.Promise {\n\t\t\treturn promise(vu, func() (any, error) {\n\t\t\t\treturn bc.Cookies(urls...) //nolint:wrapcheck\n\t\t\t})\n\t\t},\n\t\t\"grantPermissions\": func(permissions []string, opts sobek.Value) (*sobek.Promise, error) {\n\t\t\tpopts, err := exportTo[common.GrantPermissionsOptions](vu.Runtime(), opts)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"parsing grant permission options: %w\", err)\n\t\t\t}\n\t\t\treturn promise(vu, func() (any, error) {\n\t\t\t\treturn nil, bc.GrantPermissions(permissions, popts)\n\t\t\t}), nil\n\t\t},\n\t\t\"setDefaultNavigationTimeout\": bc.SetDefaultNavigationTimeout,\n\t\t\"setDefaultTimeout\":           bc.SetDefaultTimeout,\n\t\t\"setGeolocation\": func(geolocation sobek.Value) (*sobek.Promise, error) {\n\t\t\tgl, err := exportTo[common.Geolocation](vu.Runtime(), geolocation)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"parsing geo location: %w\", err)\n\t\t\t}\n\t\t\treturn promise(vu, func() (any, error) {\n\t\t\t\treturn nil, bc.SetGeolocation(&gl)\n\t\t\t}), nil\n\t\t},\n\t\t\"setHTTPCredentials\": func(httpCredentials sobek.Value) (*sobek.Promise, error) {\n\t\t\tcreds, err := exportTo[common.Credentials](rt, httpCredentials)","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/internal/js/modules/k6/browser/browser/browser_context_mapping.go#L68-L104","documentation":"Generic parse wrapper for browserContext.grantPermissions: the options sobek.Value passed as the second argument failed to decode into common.GrantPermissionsOptions via exportTo. The wrapped error identifies the malformed field (usually an unexpected type or unknown key).","triggerScenarios":"Thrown at internal/js/modules/k6/browser/browser/browser_context_mapping.go:86 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a plain options object with only expected keys, e.g. grantPermissions(['geolocation'], { origin: 'https://example.com' })","Check field types against the browser module API docs","Omit the options argument entirely if no options are needed"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"01ffac6f245854c1b8adc6a69857c76a15f90022","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":"2026-08-18T03:05:52.393Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}