grafana/k6 · error

error while initializing executor

Error message

error while initializing executor %s: %w

What it means

initVUsAndExecutors wraps an executor's Init failure; %s is the scenario/executor name from its config. The wrapped error is the executor-specific cause — usually an invalid scenario configuration (e.g. bad arrival rate, start time, or max-duration settings) detected at initialization time.

Solutions

  1. Read the wrapped error to identify the executor-specific problem
  2. Validate scenario options (vus, iterations, rate, duration, startTime, maxDuration) in the scenarios config
  3. Check that startTime/maxDuration values parse as valid durations
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at internal/execution/scheduler.go:317 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of grafana/k6@01ffac6f24 (2026-08-18). Data as JSON: /api/errors/3e152a0a29440df0. Report an issue: GitHub.

Appendix: source

Thrown at internal/execution/scheduler.go:317

		initErr = err
		cancel(initErr)
	}

	if initErr != nil {
		return initErr
	}

	e.state.SetInitVUFunc(func(ctx context.Context, logger *logrus.Entry) (lib.InitializedVU, error) {
		return e.initVU(ctx, samplesOut, logger)
	})

	e.state.SetExecutionStatus(lib.ExecutionStatusInitExecutors)
	logger.Debugf("Finished initializing needed VUs, start initializing executors...")
	for _, exec := range e.executors {
		executorConfig := exec.GetConfig()

		if err := exec.Init(ctx); err != nil {
			return fmt.Errorf("error while initializing executor %s: %w", executorConfig.GetName(), err)
		}
		logger.Debugf("Initialized executor %s", executorConfig.GetName())
	}

	e.state.SetExecutionStatus(lib.ExecutionStatusInitDone)
	logger.Debugf("Initialization completed")
	return nil
}

// runExecutor gets called by the public Run() method once per configured
// executor, each time in a new goroutine. It is responsible for waiting out the
// configured startTime for the specific executor and then running its Run()
// method.
func (e *Scheduler) runExecutor(
	runCtx context.Context, runResults chan<- error, engineOut chan<- metrics.SampleContainer, executor lib.Executor,
) {
	executorConfig := executor.GetConfig()
	executorStartTime := executorConfig.GetStartTime()

View on GitHub (pinned to 01ffac6f24)