grafana/k6 · error
calling function
Error message
calling function: %w
What it means
Returned by Frame.runActionOnSelector when invoking the element-handle action function (the actual state read or operation) fails after the element was successfully resolved. The wrapped error is the action's own failure: evaluation error, timeout, or CDP cause.
Solutions
- Inspect the wrapped action error for the root cause
- Retry after the DOM/frame stabilizes
- Increase the relevant timeout
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at internal/js/modules/k6/browser/common/frame.go:2369 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/44c218fad361c18a.
Report an issue: GitHub.
Appendix: source
Thrown at internal/js/modules/k6/browser/common/frame.go:2377
// id returns the CDP runtime ID of this execution context.
ID() runtime.ExecutionContextID
}
func (f *Frame) runActionOnSelector(
ctx context.Context, selector string, strict bool, fn elementHandleActionFunc, nullResponder func() bool,
) (bool, error) {
handle, err := f.Query(selector, strict)
if err != nil {
return false, fmt.Errorf("query: %w", err)
}
if handle == nil {
f.log.Debugf("Frame:runActionOnSelector:nilHandler", "fid:%s furl:%q selector:%s", f.ID(), f.URL(), selector)
return nullResponder(), err
}
v, err := fn(ctx, handle)
if err != nil {
return false, fmt.Errorf("calling function: %w", err)
}
bv, ok := v.(bool)
if !ok {
return false, fmt.Errorf("unexpected type %T", v)
}
return bv, nil
}
//nolint:unparam
func (f *Frame) newAction(
selector string, state DOMElementState, strict bool, fn elementHandleActionFunc, states []string,
force bool, retry bool, noWaitAfter bool, timeout time.Duration,
) func(apiCtx context.Context, resultCh chan any, errCh chan error) {
// We execute a frame action in the following steps:
// 1. Find element matching specified selector
// 2. Wait for it to reach specified DOM stateView on GitHub (pinned to 3fcf5388d7)