grafana/k6 · error

104

104

Error message

There were problems with the specified script configuration:
	- ${error}

What it means

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).

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 93accf6570)

Solutions

  1. 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'
  2. Export the referenced function from the script (export function dep() {...}) or fix the exec string to match an existing export
  3. Remember 'default' is invoked implicitly and is not a valid exec target — name and export the function you want a scenario to run
  4. Re-run; validation fails fast before any load is generated

Example fix

// before
export const options = {
  scenarios: { dep1: { executor: 'per-vu-iterations', exec: 'dep' } },
};
export default function () { http.get('https://example.com'); }

// after
export const options = {
  scenarios: { dep1: { executor: 'per-vu-iterations', exec: 'dep' } },
};
export function dep() { http.get('https://example.com'); }
export default dep;
Defensive patterns

Strategy: validation

Validate before calling

// run a fast parse+config check before load is generated:
// `k6 inspect script.js` exercises option consolidation and surfaces the
// same bullet list (missing exec functions, invalid options) without running
// the test. Use it as a CI lint step.

Try / catch

if err := cmd.Execute(); err != nil {
    if strings.HasPrefix(err.Error(), "There were problems with the specified script configuration") {
        // each '- ' bullet is one validation failure; fail the pipeline with
        // the parsed list rather than retrying — this is deterministic
    }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of grafana/k6@93accf6570 (2026-08-15). Data as JSON: /api/errors/348f19063081c4c3. Report an issue: GitHub.