{"record":{"id":"3457878b22f5d39b","repo":"grafana/k6","slug":"there-were-problems-with-the-specified-script-conf","errorCode":null,"errorMessage":"There were problems with the specified script configuration:\n\t- ${error}","messagePattern":"There were problems with the specified script configuration:\n\t- (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/cmd/config.go","lineNumber":353,"sourceCode":"\t\tif err := validateScenarioConfig(ec, isExecutable); err != nil {\n\t\t\terrList = append(errList, err)\n\t\t}\n\t}\n\n\treturn consolidateErrorMessage(errList, \"There were problems with the specified script configuration:\")\n}\n\nfunc consolidateErrorMessage(errList []error, title string) error {\n\tif len(errList) == 0 {\n\t\treturn nil\n\t}\n\n\terrMsgParts := []string{title}\n\tfor _, err := range errList {\n\t\terrMsgParts = append(errMsgParts, fmt.Sprintf(\"\\t- %s\", err.Error()))\n\t}\n\n\treturn errors.New(strings.Join(errMsgParts, \"\\n\"))\n}\n\nfunc validateScenarioConfig(conf lib.ExecutorConfig, isExecutable func(string) bool) error {\n\texecFn := conf.GetExec()\n\tif !isExecutable(execFn) {\n\t\treturn fmt.Errorf(\"executor %s: function '%s' not found in exports\", conf.GetName(), execFn)\n\t}\n\treturn nil\n}\n","sourceCodeStart":335,"sourceCodeEnd":363,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/internal/cmd/config.go#L335-L363","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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"],"exampleFix":"// before — exec references a function that is not exported\nexport const options = {\n  scenarios: { api: { executor: 'per-vu-iterations', vus: 2, exec: 'apitest' } },\n};\nfunction apitest() { /* ... */ }   // not exported -> validation error\n\n// after\nexport function apitest() { /* ... */ }","handlingStrategy":"validation","validationCode":"// Node: assert every scenario exec is exported before running k6\nconst fs = require('fs');\nconst src = fs.readFileSync('script.js', 'utf8');\nconst m = new module.constructor();\nm._compile(src, 'script.js');\nfor (const [name, sc] of Object.entries(m.exports.options?.scenarios ?? {})) {\n  if (sc.exec && typeof m.exports[sc.exec] !== 'function') {\n    throw new Error(`scenario ${name}: exec '${sc.exec}' is not exported`);\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["k6","configuration","validation","scenarios","exit-code-104"],"backgroundTag":"invalid-config-value","analyzedSha":"01ffac6f245854c1b8adc6a69857c76a15f90022","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}