{"record":{"id":"59f9d864aaf8c25c","repo":"grafana/k6","slug":"evaluating-handle-for-frame-w","errorCode":null,"errorMessage":"evaluating handle for frame: %w","messagePattern":"evaluating handle for frame: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/common/frame.go","lineNumber":927,"sourceCode":"// EvaluateHandle will evaluate provided page function within an execution context.\nfunc (f *Frame) EvaluateHandle(pageFunc string, args ...any) (handle JSHandleAPI, _ error) {\n\tf.log.Debugf(\"Frame:EvaluateHandle\", \"fid:%s furl:%q\", f.ID(), f.URL())\n\n\tevalHandle := func() (JSHandleAPI, error) {\n\t\tf.executionContextMu.RLock()\n\t\tdefer f.executionContextMu.RUnlock()\n\n\t\tec := f.executionContexts[mainWorld]\n\t\tif ec == nil {\n\t\t\treturn nil, fmt.Errorf(\"evaluating handle for frame: execution context %q not found\", mainWorld)\n\t\t}\n\t\treturn ec.EvalHandle(f.ctx, pageFunc, args...) //nolint:wrapcheck\n\t}\n\n\tf.waitForExecutionContext(mainWorld)\n\thandle, err := evalHandle()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"evaluating handle for frame: %w\", err)\n\t}\n\n\tapplySlowMo(f.ctx)\n\n\treturn handle, nil\n}\n\n// Fill fills out the first element found that matches the selector.\nfunc (f *Frame) Fill(selector, value string, popts *FrameFillOptions) error {\n\tf.log.Debugf(\"Frame:Fill\", \"fid:%s furl:%q sel:%q val:%q\", f.ID(), f.URL(), selector, value)\n\n\tif err := f.fill(selector, value, popts); err != nil {\n\t\treturn fmt.Errorf(\"filling %q with %q: %w\", selector, value, err)\n\t}\n\n\tapplySlowMo(f.ctx)\n\n\treturn nil","sourceCodeStart":909,"sourceCodeEnd":945,"githubUrl":"https://github.com/grafana/k6/blob/3fcf5388d78cb382f0c0d42ec556a06bfd1b8dee/internal/js/modules/k6/browser/common/frame.go#L909-L945","documentation":"Returned by Frame.EvaluateHandle when the deferred evalHandle closure fails — either the context lookup errored (see the not-found case) or ec.EvalHandle failed evaluating the page function (JS exception, CDP error). Wrap-only site adding the operation name.","triggerScenarios":"Thrown at internal/js/modules/k6/browser/common/frame.go:919 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the wrapped error for JS exceptions in the page function","Retry after the frame stabilizes","Ensure arguments are serializable"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3fcf5388d78cb382f0c0d42ec556a06bfd1b8dee","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":"2026-08-18T03:05:52.393Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}