grafana/k6 · error
checking is enabled: unexpected type %T
Error message
checking is %q enabled: unexpected type %T
What it means
Returned by Frame.isEnabled as a type guard: the enabled-state evaluation yielded a value that is not a bool. Reported with selector and actual Go type; internal contract violation since the injected script must return boolean.
Solutions
- Retry the check after the page settles
- Report as a k6 browser module bug if persistent
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at internal/js/modules/k6/browser/common/frame.go:1475 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of grafana/k6@3fcf5388d7 (2026-08-18).
Data as JSON: /api/errors/2b0f5ab6cb093bc6.
Report an issue: GitHub.
Appendix: source
Thrown at internal/js/modules/k6/browser/common/frame.go:1483
func (f *Frame) isEnabled(selector string, opts *FrameIsEnabledOptions) (bool, error) {
isEnabled := func(apiCtx context.Context, handle *ElementHandle) (any, error) {
v, err := handle.isEnabled(apiCtx, 0) // Zero timeout when checking state
if errors.Is(err, ErrTimedOut) { // We don't care about timeout errors here!
return v, nil
}
return v, err
}
act := f.newAction(
selector, DOMElementStateAttached, opts.Strict, isEnabled, []string{}, false, withRetry, true, opts.Timeout,
)
v, err := call(f.ctx, act, opts.Timeout)
if err != nil {
return false, errorFromDOMError(err)
}
bv, ok := v.(bool)
if !ok {
return false, fmt.Errorf("checking is %q enabled: unexpected type %T", selector, v)
}
return bv, nil
}
// IsDisabled returns true if the first element that matches the selector
// is disabled. Otherwise, returns false.
func (f *Frame) IsDisabled(selector string, opts *FrameIsDisabledOptions) (bool, error) {
f.log.Debugf("Frame:IsDisabled", "fid:%s furl:%q sel:%q", f.ID(), f.URL(), selector)
disabled, err := f.isDisabled(selector, opts)
if err != nil {
return false, fmt.Errorf("checking is %q disabled: %w", selector, err)
}
return disabled, nil
}
View on GitHub (pinned to 3fcf5388d7)