grafana/k6 · error
unmarshaling polling type
Error message
unmarshaling polling type: %w
What it means
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.
Solutions
- Pass polling as 'raf', 'mutation', or a number (interval in ms)
- Do not pass objects, booleans, or unquoted identifiers as polling
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at internal/js/modules/k6/browser/common/frame_options.go:181 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of grafana/k6@8d06114777 (2026-08-18).
Data as JSON: /api/errors/05fe180de489d54b.
Report an issue: GitHub.
Appendix: source
Thrown at internal/js/modules/k6/browser/common/frame_options.go:179
func PollingIDFromString(format string) (PollingType, bool) {
id, exists := pollingTypeToID[format]
return id, exists
}
// MarshalJSON marshals the enum as a quoted JSON string.
func (p PollingType) MarshalJSON() ([]byte, error) {
buffer := bytes.NewBufferString(`"`)
buffer.WriteString(pollingTypeToString[p])
buffer.WriteString(`"`)
return buffer.Bytes(), nil
}
// UnmarshalJSON unmarshals a quoted JSON string to the enum value.
func (p *PollingType) UnmarshalJSON(b []byte) error {
var j string
err := json.Unmarshal(b, &j)
if err != nil {
return fmt.Errorf("unmarshaling polling type: %w", err)
}
// Note that if the string cannot be found then it will be set to the zero value.
*p = pollingTypeToID[j]
return nil
}
type FrameWaitForFunctionOptions struct {
Polling PollingType `json:"polling"`
Interval int64 `json:"interval"`
Timeout time.Duration `json:"timeout"`
}
type FrameWaitForLoadStateOptions struct {
Timeout time.Duration `json:"timeout"`
}
type FrameWaitForNavigationOptions struct {
URL string `json:"url"`View on GitHub (pinned to 8d06114777)