grafana/k6 · error
could not load and configure the test
Error message
could not load and configure the test: %w
What it means
In cloud run with --local-execution, loadAndConfigureLocalTest failed to load the script/archive and apply cloud-oriented configuration. The wrapped error carries the concrete cause: unreadable or missing file, syntax error, invalid options, or bad config merging.
Solutions
- Inspect the wrapped error for the root cause
- Verify the script path is correct and the script runs locally with k6 run
- Fix syntax errors and invalid options in the script
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at internal/cmd/cloud_run.go:153 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of grafana/k6@94169daab2 (2026-08-18).
Data as JSON: /api/errors/3db6b9e78252cbbf.
Report an issue: GitHub.
Appendix: source
Thrown at internal/cmd/cloud_run.go:159
)
}
if c.noCloudLogs {
return errext.WithExitCodeIfNone(
fmt.Errorf("the --no-cloud-logs flag can only be used in conjunction with the --local-execution flag"),
exitcodes.InvalidConfig,
)
}
return applyCloudEnvOverrides(c.gs, cmd, &c.showCloudLogs, &c.exitOnRunning)
}
func (c *cmdCloudRun) run(cmd *cobra.Command, args []string) error {
if c.localExecution {
c.runCmd.loadConfiguredTest = func(*cobra.Command, []string) (*loadedAndConfiguredTest, execution.Controller, error) {
test, err := loadAndConfigureLocalTest(c.runCmd.gs, cmd, args, getCloudRunLocalExecutionConfig)
if err != nil {
return nil, nil, fmt.Errorf("could not load and configure the test: %w", err)
}
if err := createCloudTest(c.runCmd.gs, test); err != nil {
if errors.Is(err, errCloudAuth) {
return nil, nil, err
}
return nil, nil, fmt.Errorf("could not create the cloud test run: %w", err)
}
return test, local.NewController(), nil
}
return c.runCmd.run(cmd, args)
}
// When running the `k6 cloud run` command explicitly disable the usage report.
c.noUsageReport = true
return runCloudTest(c.gs, cmd, args, cloudTestRunOptions{View on GitHub (pinned to 94169daab2)