grafana/k6 · error
parsing element input value options: %w
Error message
parsing element input value options: %w
What it means
Thrown synchronously by ElementHandle.inputValue() when its options fail to parse. inputValue() parses common.ElementHandleBaseOptions (force, noWaitAfter, timeout), whose Parse in common/element_handle_options.go is all lenient coercion and always returns nil, so this wrap is defensive and effectively unreachable in current k6. Seeing it usually means an older xk6-browser Parse implementation or a regression.
Source
Thrown at internal/js/modules/k6/browser/browser/element_handle_mapping.go:119
}
return promise(vu, func() (any, error) {
return nil, eh.Hover(popts) //nolint:wrapcheck
}), nil
},
"innerHTML": func() *sobek.Promise {
return promise(vu, func() (any, error) {
return eh.InnerHTML() //nolint:wrapcheck
})
},
"innerText": func() *sobek.Promise {
return promise(vu, func() (any, error) {
return eh.InnerText() //nolint:wrapcheck
})
},
"inputValue": func(opts sobek.Value) (*sobek.Promise, error) {
popts := common.NewElementHandleBaseOptions(eh.DefaultTimeout())
if err := popts.Parse(vu.Context(), opts); err != nil {
return nil, fmt.Errorf("parsing element input value options: %w", err)
}
return promise(vu, func() (any, error) {
return eh.InputValue(popts) //nolint:wrapcheck
}), nil
},
"isChecked": func() *sobek.Promise {
return promise(vu, func() (any, error) {
return eh.IsChecked() //nolint:wrapcheck
})
},
"isDisabled": func() *sobek.Promise {
return promise(vu, func() (any, error) {
return eh.IsDisabled() //nolint:wrapcheck
})
},
"isEditable": func() *sobek.Promise {
return promise(vu, func() (any, error) {
return eh.IsEditable() //nolint:wrapcheckView on GitHub (pinned to 93accf6570)
Solutions
- Use only { force, noWaitAfter, timeout } with a millisecond number for timeout
- Confirm the element is an input/textarea/select before calling inputValue
- Upgrade k6 to a current version where base Parse cannot fail, then re-test
- Read the wrapped cause after the colon to identify the failing field in your build
Example fix
// before
const v = await el.inputValue({ timeout: '30s' });
// after
const v = await el.inputValue({ timeout: 30000 }); Defensive patterns
Strategy: try-catch
Validate before calling
if (opts?.timeout !== undefined && !Number.isFinite(Number(opts.timeout))) {
throw new Error('inputValue(): timeout must be a number of milliseconds');
}
const tag = await el.getProperty('tagName').then(r => r.jsonValue());
if (!/INPUT|TEXTAREA|SELECT/.test(String(tag))) {
throw new Error(`inputValue(): ${tag} is not an input element`);
} Type guard
function isInputValueOpts(o) {
if (o == null) return true;
return (o.force === undefined || typeof o.force === 'boolean') &&
(o.noWaitAfter === undefined || typeof o.noWaitAfter === 'boolean') &&
(o.timeout === undefined || Number.isFinite(o.timeout));
} Try / catch
try {
const v = await el.inputValue(opts);
} catch (e) {
if (/parsing element input value options/.test(String(e.message))) {
console.log(`fix inputValue options: ${e.message}`);
} else throw e; // e.g. 'node is not an <input> element' happens inside the promise
} Prevention
- Check the element tag before inputValue(); the common real error is not a parse error
- Keep timeout numeric in milliseconds
- Seeing this message on modern k6 indicates a regression: capture the wrapped cause and k6 version
When it happens
Trigger: In current code none: force/noWaitAfter/timeout coerce any JS value and unknown keys are ignored. Older builds could fail when the whole options object could not be exported onto the struct.
Common situations: Scripts written for old xk6-browser releases; passing a timeout in seconds or as '30s' (silently coerced to a wrong duration rather than erroring); confusing this parse error with the later inside-promise error 'node is not an <input> element'.
Related errors
- parsing check options: %w
- parsing element click options: %w
- parsing element double click options: %w
- parsing element fill options: %w
- parsing element hover options: %w
AI-assisted analysis of grafana/k6@93accf6570 (2026-08-15).
Data as JSON: /api/errors/cc1e691676e6c26f.
Report an issue: GitHub.