grafana/k6 · error

executor : function ' ' not found in exports

Error message

executor %s: function '%s' not found in exports

What it means

Scenario validation error: a scenario/executor's exec option names a JS function that is not exported by the script, so that scenario has nothing to run. validateScenarioConfig fires during config validation before the test starts.

Solutions

  1. Export the named function from the script: export function myFn() { ... }
  2. Fix the exec value or scenario key typo in the scenarios configuration
  3. Ensure the default function exists when exec is omitted
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at internal/cmd/config.go:359 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/30eaa7340daeeeef. Report an issue: GitHub.

Appendix: source

Thrown at internal/cmd/config.go:367

}

func consolidateErrorMessage(errList []error, title string) error {
	if len(errList) == 0 {
		return nil
	}

	errMsgParts := []string{title}
	for _, err := range errList {
		errMsgParts = append(errMsgParts, fmt.Sprintf("\t- %s", err.Error()))
	}

	return errors.New(strings.Join(errMsgParts, "\n"))
}

func validateScenarioConfig(conf lib.ExecutorConfig, isExecutable func(string) bool) error {
	execFn := conf.GetExec()
	if !isExecutable(execFn) {
		return fmt.Errorf("executor %s: function '%s' not found in exports", conf.GetName(), execFn)
	}
	return nil
}

View on GitHub (pinned to 3fcf5388d7)