{"record":{"id":"6da476e3713f1e13","repo":"grafana/k6","slug":"parsing-inner-text-options-w-6da476","errorCode":null,"errorMessage":"parsing inner text options: %w","messagePattern":"parsing inner text options: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/browser/locator_mapping.go","lineNumber":317,"sourceCode":"\t\t\treturn mapLocator(vu, lo.Locator(selector, parseLocatorOptions(rt, opts)))\n\t\t},\n\t\t\"frameLocator\": func(selector string) *sobek.Object {\n\t\t\tmfl := mapFrameLocator(vu, lo.FrameLocator(selector))\n\t\t\treturn rt.ToValue(mfl).ToObject(rt)\n\t\t},\n\t\t\"innerHTML\": func(opts sobek.Value) (*sobek.Promise, error) {\n\t\t\tcopts, err := parseFrameInnerHTMLOptions(rt, opts, lo.Timeout())\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"parsing inner HTML options: %w\", err)\n\t\t\t}\n\t\t\treturn promise(vu, func() (any, error) {\n\t\t\t\treturn lo.InnerHTML(copts) //nolint:wrapcheck\n\t\t\t}), nil\n\t\t},\n\t\t\"innerText\": func(opts sobek.Value) (*sobek.Promise, error) {\n\t\t\tcopts, err := parseFrameInnerTextOptions(rt, opts, lo.Timeout())\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"parsing inner text options: %w\", err)\n\t\t\t}\n\t\t\treturn promise(vu, func() (any, error) {\n\t\t\t\treturn lo.InnerText(copts) //nolint:wrapcheck\n\t\t\t}), nil\n\t\t},\n\t\t\"last\": func() *sobek.Object {\n\t\t\tml := mapLocator(vu, lo.Last())\n\t\t\treturn rt.ToValue(ml).ToObject(rt)\n\t\t},\n\t\t\"nth\": func(nth int) *sobek.Object {\n\t\t\tml := mapLocator(vu, lo.Nth(nth))\n\t\t\treturn rt.ToValue(ml).ToObject(rt)\n\t\t},\n\t\t\"textContent\": func(opts sobek.Value) (*sobek.Promise, error) {\n\t\t\tcopts, err := parseFrameTextContentOptions(rt, opts, lo.Timeout())\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"parsing text content options: %w\", err)\n\t\t\t}","sourceCodeStart":299,"sourceCodeEnd":335,"githubUrl":"https://github.com/grafana/k6/blob/8d06114777191d21ef885d05c5f8aa9e1ed838ae/internal/js/modules/k6/browser/browser/locator_mapping.go#L299-L335","documentation":"Thrown synchronously when the options argument to locator.innerText() fails to parse. The mapping (locator_mapping.go:314-318) builds common.FrameInnerTextOptions (FrameBaseOptions) and wraps Parse errors as \"parsing inner text options: %w\". Parse only reads strict/timeout with coercing accessors, so a genuine failure means sobek raised reading the object — throwing getter, Proxy trap, or a value whose numeric coercion throws.","triggerScenarios":"opts with a getter for timeout/strict that raises; Proxy options with throwing traps; a non-number timeout with a throwing toPrimitive/valueOf.","commonSituations":"Text-extraction helpers that build options from lazily-validated config; debugging Proxies over arguments; ported Playwright utilities that decorate options.","solutions":["Use a plain literal: locator.innerText({ timeout: 5000 }) or omit options","Precompute dynamic values into plain properties","Do not pass Proxy/accessor objects to the browser module","try/catch the call to capture the failure with context"],"exampleFix":"// before\nawait locator.innerText(lazyOpts); // getter throws\n\n// after\nawait locator.innerText({ timeout: lazyOpts.timeout }); // property read happens safely first","handlingStrategy":"try-catch","validationCode":null,"typeGuard":"function isPlainBaseOptions(o) {\n  return o == null || (typeof o === 'object' &&\n    (o.timeout === undefined || typeof o.timeout === 'number') &&\n    (o.strict === undefined || typeof o.strict === 'boolean'));\n}","tryCatchPattern":"try {\n  const text = await locator.innerText(opts);\n} catch (e) {\n  throw new Error(`innerText failed (ensure options are plain data): ${e}`);\n}","preventionTips":["Omit options when defaults work","Materialize lazy values before building options","Keep instrumentation wrappers away from browser calls"],"tags":["k6","browser","locator","innertext","options"],"backgroundTag":"invalid-options-object","analyzedSha":"8d06114777191d21ef885d05c5f8aa9e1ed838ae","analyzedAt":"2026-09-14T20:10:14.619Z","contentChangedAt":"2026-09-14T20:10:14.619Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}