{"record":{"id":"348f19063081c4c3","repo":"grafana/k6","slug":"104","errorCode":"104","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/93accf6570dcd306ca5e99cc44c393ee3797761b/internal/cmd/config.go#L335-L363","documentation":"consolidateErrorMessage aggregates a list of configuration-validation errors under one title ('There were problems with the specified script configuration:'), each indented as a '- ' bullet, and the command exits with code 104 (InvalidConfig). The ${error} placeholders are the individual validation failures — most commonly a scenario whose exec function is not in the script's exports (validateScenarioConfig).","triggerScenarios":"Running `k6 run`/`k6 cloud run` when scenario configs fail validation: an options.scenarios[].exec naming a function that the script does not export, or other per-option validation errors collected during config consolidation. Each failing item becomes one bullet line.","commonSituations":"Renaming a JS function but not the exec value in options; exec referencing 'default' (which is not an export); wrapping scenarios in options without exporting the named helpers; typos in exec strings; script built from a template where helper exports were removed.","solutions":["Read every bullet under the title — each names the executor and the missing function, e.g. 'executor per-vu-iterations: function \\'dep\\' not found in exports'","Export the referenced function from the script (export function dep() {...}) or fix the exec string to match an existing export","Remember 'default' is invoked implicitly and is not a valid exec target — name and export the function you want a scenario to run","Re-run; validation fails fast before any load is generated"],"exampleFix":"// before\nexport const options = {\n  scenarios: { dep1: { executor: 'per-vu-iterations', exec: 'dep' } },\n};\nexport default function () { http.get('https://example.com'); }\n\n// after\nexport const options = {\n  scenarios: { dep1: { executor: 'per-vu-iterations', exec: 'dep' } },\n};\nexport function dep() { http.get('https://example.com'); }\nexport default dep;","handlingStrategy":"validation","validationCode":"// run a fast parse+config check before load is generated:\n// `k6 inspect script.js` exercises option consolidation and surfaces the\n// same bullet list (missing exec functions, invalid options) without running\n// the test. Use it as a CI lint step.","typeGuard":null,"tryCatchPattern":"if err := cmd.Execute(); err != nil {\n    if strings.HasPrefix(err.Error(), \"There were problems with the specified script configuration\") {\n        // each '- ' bullet is one validation failure; fail the pipeline with\n        // the parsed list rather than retrying — this is deterministic\n    }\n}","preventionTips":["Run `k6 inspect script.js` in CI to validate scenarios/options before any execution","Keep scenario exec strings adjacent to the exported functions and update both on rename","Export every function referenced by options.scenarios[*].exec; 'default' alone is not addressable"],"tags":["cli","configuration","validation","scenarios","exit-code"],"backgroundTag":null,"analyzedSha":"93accf6570dcd306ca5e99cc44c393ee3797761b","analyzedAt":"2026-08-15T21:23:27.118Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}