grafana/k6 · error
could not serialize cloud configuration: %w
Error message
could not serialize cloud configuration: %w
What it means
Error "could not serialize cloud configuration: %w" thrown in grafana/k6.
Source
Thrown at internal/cmd/outputs_cloud.go:241
token := gs.Env["K6_CLOUD_TEST_RUN_TOKEN"]
if (pushURL == "") != (token == "") {
return errors.New("both K6_CLOUD_METRICS_PUSH_URL and " +
"K6_CLOUD_TEST_RUN_TOKEN must be set together")
}
// A logs push URL is authenticated with the same scoped token, so reject a
// logs URL supplied without it rather than silently streaming nothing.
if token == "" && conf.LogsPushURL.Valid && conf.LogsPushURL.String != "" {
return errors.New("K6_CLOUD_LOGS_PUSH_URL requires K6_CLOUD_TEST_RUN_TOKEN")
}
if pushURL == "" {
return nil
}
conf.MetricsPushURL = null.StringFrom(pushURL)
conf.TestRunToken = null.StringFrom(token)
raw, err := cloudConfToRawMessage(*conf)
if err != nil {
return fmt.Errorf("could not serialize cloud configuration: %w", err)
}
if test.derivedConfig.Collectors == nil {
test.derivedConfig.Collectors = make(map[string]json.RawMessage)
}
test.derivedConfig.Collectors[builtinOutputCloud.String()] = raw
return nil
}
// externalLogsConfig mirrors the K6_CLOUD_LOGS_* env vars an external
// orchestrator uses to hand the log-push settings to a local k6. These are
// read explicitly (the Logs* fields are not env-bound on cloudapi.Config) so a
// stray env value can't override the run-scoped logs config in the
// self-provisioned flow.
type externalLogsConfig struct {
PushURL null.String `envconfig:"K6_CLOUD_LOGS_PUSH_URL"`
Level null.String `envconfig:"K6_CLOUD_LOGS_LEVEL"`
Limit null.Int `envconfig:"K6_CLOUD_LOGS_LIMIT"`
PushPeriod types.NullDuration `envconfig:"K6_CLOUD_LOGS_PUSH_PERIOD"`View on GitHub (pinned to 93accf6570)
When it happens
Trigger: Thrown at internal/cmd/outputs_cloud.go:241 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of grafana/k6@93accf6570 (2026-08-15).
Data as JSON: /api/errors/25542cf17958baaf.
Report an issue: GitHub.