{"record":{"id":"05fe180de489d54b","repo":"grafana/k6","slug":"unmarshaling-polling-type-w","errorCode":null,"errorMessage":"unmarshaling polling type: %w","messagePattern":"unmarshaling polling type: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/common/frame_options.go","lineNumber":179,"sourceCode":"func PollingIDFromString(format string) (PollingType, bool) {\n\tid, exists := pollingTypeToID[format]\n\treturn id, exists\n}\n\n// MarshalJSON marshals the enum as a quoted JSON string.\nfunc (p PollingType) MarshalJSON() ([]byte, error) {\n\tbuffer := bytes.NewBufferString(`\"`)\n\tbuffer.WriteString(pollingTypeToString[p])\n\tbuffer.WriteString(`\"`)\n\treturn buffer.Bytes(), nil\n}\n\n// UnmarshalJSON unmarshals a quoted JSON string to the enum value.\nfunc (p *PollingType) UnmarshalJSON(b []byte) error {\n\tvar j string\n\terr := json.Unmarshal(b, &j)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unmarshaling polling type: %w\", err)\n\t}\n\t// Note that if the string cannot be found then it will be set to the zero value.\n\t*p = pollingTypeToID[j]\n\treturn nil\n}\n\ntype FrameWaitForFunctionOptions struct {\n\tPolling  PollingType   `json:\"polling\"`\n\tInterval int64         `json:\"interval\"`\n\tTimeout  time.Duration `json:\"timeout\"`\n}\n\ntype FrameWaitForLoadStateOptions struct {\n\tTimeout time.Duration `json:\"timeout\"`\n}\n\ntype FrameWaitForNavigationOptions struct {\n\tURL       string         `json:\"url\"`","sourceCodeStart":161,"sourceCodeEnd":197,"githubUrl":"https://github.com/grafana/k6/blob/8d06114777191d21ef885d05c5f8aa9e1ed838ae/internal/js/modules/k6/browser/common/frame_options.go#L161-L197","documentation":"Returned by PollingType.UnmarshalJSON when the raw JSON for a polling option is not a valid string, so json.Unmarshal into the string sink fails. The value must be a quoted string like \"raf\" or \"mutation\" (numeric intervals are handled elsewhere); other JSON shapes are rejected here.","triggerScenarios":"Thrown at internal/js/modules/k6/browser/common/frame_options.go:181 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass polling as 'raf', 'mutation', or a number (interval in ms)","Do not pass objects, booleans, or unquoted identifiers as polling"],"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"}