grafana/k6 · error
There were problems with the specified script configuration:
Error message
There were problems with the specified script configuration:
- ${error} What it means
consolidateErrorMessage aggregates every problem found during config validation into one report: lib.Options.Validate() failures plus per-scenario checks that each executor's `exec` function exists in the script's exports. The final error joins a title with one '\t- <error>' bullet per problem and k6 exits with code 104 (InvalidConfig). If you see it, at least one listed bullet is a real config or script defect.
Source
Thrown at internal/cmd/config.go:353
if err := validateScenarioConfig(ec, isExecutable); err != nil {
errList = append(errList, err)
}
}
return consolidateErrorMessage(errList, "There were problems with the specified script configuration:")
}
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 01ffac6f24)
Solutions
- Read every bullet under the title — each line names one concrete defect; fix them all
- For 'function not found in exports', export the function or fix the exec name in the scenario config
- For options errors, check the named option's type/value against the k6 options docs
- Validate the script quickly with `k6 inspect script.js` before wiring it into CI
Example fix
// before — exec references a function that is not exported
export const options = {
scenarios: { api: { executor: 'per-vu-iterations', vus: 2, exec: 'apitest' } },
};
function apitest() { /* ... */ } // not exported -> validation error
// after
export function apitest() { /* ... */ } Defensive patterns
Strategy: validation
Validate before calling
// Node: assert every scenario exec is exported before running k6
const fs = require('fs');
const src = fs.readFileSync('script.js', 'utf8');
const m = new module.constructor();
m._compile(src, 'script.js');
for (const [name, sc] of Object.entries(m.exports.options?.scenarios ?? {})) {
if (sc.exec && typeof m.exports[sc.exec] !== 'function') {
throw new Error(`scenario ${name}: exec '${sc.exec}' is not exported`);
}
} Prevention
- Run `k6 inspect script.js` as a CI lint step — it exercises config parsing cheaply
- Export every function referenced by options.scenarios[*].exec (and `export default`)
- After renaming a function, grep the script for the old name to catch stale exec references
When it happens
Trigger: Running any test (k6 run/cloud run) where: a scenario's exec names a function that is not exported ('executor X: function Y not found in exports'); options violate invariants (e.g. invalid execution-segment, bad option types in the exported options object, mutually inconsistent scenario fields). Called from deriveAndValidateConfig after scenario derivation, via validateConfig (internal/cmd/config.go:331-341).
Common situations: Typo in the exec name; forgetting `export default` or forgetting to export the named function; renaming a function in the script but not in options.scenarios; hand-written options objects with wrong types; multiple bullets appear when several scenarios share the mistake.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- tests with unspecified duration are not allowed when outputt
- stack URL is required to validate token
- invalid tag, empty name
- invalid tag, empty value
- invalid tag, empty string
AI-assisted analysis of grafana/k6@01ffac6f24 (2026-08-18).
Data as JSON: /api/errors/3457878b22f5d39b.
Report an issue: GitHub.