grafana/k6 · error

the built-in check() does not support async functions as…

Error message

the built-in check() does not support async functions as arguments. Use the JavaScript utils library as a replacement. Refer to https://grafana.com/docs/k6/latest/javascript-api/jslib/utils/check/ for more info

What it means

Error "the built-in check() does not support async functions as arguments. Use the JavaScript utils library as a replacement. Refer to https://grafana.com/docs/k6/latest/javascript-api/jslib/utils/check/ for more info" thrown in grafana/k6.

When it happens

Trigger: Thrown at internal/js/modules/k6/k6.go:182 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/bbc8126d0a54de95. Report an issue: GitHub.

Appendix: source

Thrown at internal/js/modules/k6/k6.go:227

		}
	}

	succ := true
	var exc error
	obj := checks.ToObject(rt)
	for _, name := range obj.Keys() {
		if strings.Contains(name, lib.GroupSeparator) {
			return false, lib.ErrNameContainsGroupSeparator
		}
		val := obj.Get(name)

		tags := commonTagsAndMeta.Tags
		if state.Options.SystemTags.Has(metrics.TagCheck) {
			tags = tags.With("check", name)
		}

		if common.IsAsyncFunction(rt, val) {
			return false, errors.New("the built-in check() does not support async functions as arguments. " +
				"Use the JavaScript utils library as a replacement. " +
				"Refer to https://grafana.com/docs/k6/latest/javascript-api/jslib/utils/check/ for more info")
		}

		// Resolve callables into values.
		fn, ok := sobek.AssertFunction(val)
		if ok {
			tmpVal, err := fn(sobek.Undefined(), arg0)
			val = tmpVal
			if err != nil {
				val = rt.ToValue(false)
				exc = err
			}
		}
		booleanVal := val.ToBoolean()
		if !booleanVal {
			// A single failure makes the return value false.
			succ = false

View on GitHub (pinned to 3fcf5388d7)