{"record":{"id":"d163ea699d5ac8e1","repo":"grafana/k6","slug":"query-w","errorCode":null,"errorMessage":"query: %w","messagePattern":"query: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/common/frame.go","lineNumber":2368,"sourceCode":"\tEval(apiCtx context.Context, js string, args ...any) (any, error)\n\n\t// EvalHandle evaluates the provided JavaScript within this execution\n\t// context and returns a JSHandle.\n\tEvalHandle(apiCtx context.Context, js string, args ...any) (JSHandleAPI, error)\n\n\t// Frame returns the frame that this execution context belongs to.\n\tFrame() *Frame\n\n\t// id returns the CDP runtime ID of this execution context.\n\tID() runtime.ExecutionContextID\n}\n\nfunc (f *Frame) runActionOnSelector(\n\tctx context.Context, selector string, strict bool, fn elementHandleActionFunc, nullResponder func() bool,\n) (bool, error) {\n\thandle, err := f.Query(selector, strict)\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"query: %w\", err)\n\t}\n\tif handle == nil {\n\t\tf.log.Debugf(\"Frame:runActionOnSelector:nilHandler\", \"fid:%s furl:%q selector:%s\", f.ID(), f.URL(), selector)\n\t\treturn nullResponder(), err\n\t}\n\n\tv, err := fn(ctx, handle)\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"calling function: %w\", err)\n\t}\n\n\tbv, ok := v.(bool)\n\tif !ok {\n\t\treturn false, fmt.Errorf(\"unexpected type %T\", v)\n\t}\n\n\treturn bv, nil\n}","sourceCodeStart":2350,"sourceCodeEnd":2386,"githubUrl":"https://github.com/grafana/k6/blob/3fcf5388d78cb382f0c0d42ec556a06bfd1b8dee/internal/js/modules/k6/browser/common/frame.go#L2350-L2386","documentation":"Returned by Frame.runActionOnSelector when resolving the selector via Query fails before the action function can run. The wrap adds 'query:' context to the underlying query error: bad selector syntax or evaluation failure in the frame.","triggerScenarios":"Thrown at internal/js/modules/k6/browser/common/frame.go:2360 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix selector syntax if parsing failed","Retry if the frame was navigating during the query","Ensure the frame is attached and loaded"],"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"}