grafana/k6 · error

could not serialize overridden cloud configuration: %w

Error message

could not serialize overridden cloud configuration: %w

What it means

Error "could not serialize overridden cloud configuration: %w" thrown in grafana/k6.

Source

Thrown at internal/cmd/outputs_cloud.go:191

	conf.TestRunDetails = null.StringFrom(result.TestRunDetailsPageURL)

	// Register secrets config (always present in the provisioning response).
	if gs.CloudSecretSource != nil {
		gs.CloudSecretSource.SetConfig(&cloudsecrets.Config{
			Token:        result.RuntimeConfig.TestRunToken,
			Endpoint:     result.RuntimeConfig.Secrets.Endpoint,
			ResponsePath: result.RuntimeConfig.Secrets.ResponsePath,
		})
	}

	// Configure the log pusher for the self-provisioned run. The run id is
	// the provisioning result's TestRunID.
	configureCloudLogPusher(gs, conf, strconv.FormatInt(result.TestRunID, 10))

	// Serialise overridden Config back into the collectors map (existing pattern).
	raw, err := cloudConfToRawMessage(conf)
	if err != nil {
		return fmt.Errorf("could not serialize overridden 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
}

// applyExternalProvisioningCreds handles the externally-provisioned
// `--local-execution` flow, signalled by K6_CLOUD_PUSH_REF_ID: an external
// service created and started the run and hands its scoped push credentials
// to this local k6 via env. It reads K6_CLOUD_METRICS_PUSH_URL and
// K6_CLOUD_TEST_RUN_TOKEN explicitly here — they are deliberately NOT
// env-bound on cloudapi.Config, so a stray env var can never override the
// values the self-provision flow obtains from the provisioning response.
// It requires both-or-neither and, when both are present, sets them on conf
// (so downstream consumers such as the log pusher see them) and bakes them

View on GitHub (pinned to 93accf6570)

When it happens

Trigger: Thrown at internal/cmd/outputs_cloud.go:191 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/d198a901254b3762. Report an issue: GitHub.