{"record":{"id":"d198a901254b3762","repo":"grafana/k6","slug":"could-not-serialize-overridden-cloud-configuration","errorCode":null,"errorMessage":"could not serialize overridden cloud configuration: %w","messagePattern":"could not serialize overridden cloud configuration: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/cmd/outputs_cloud.go","lineNumber":191,"sourceCode":"\tconf.TestRunDetails = null.StringFrom(result.TestRunDetailsPageURL)\n\n\t// Register secrets config (always present in the provisioning response).\n\tif gs.CloudSecretSource != nil {\n\t\tgs.CloudSecretSource.SetConfig(&cloudsecrets.Config{\n\t\t\tToken:        result.RuntimeConfig.TestRunToken,\n\t\t\tEndpoint:     result.RuntimeConfig.Secrets.Endpoint,\n\t\t\tResponsePath: result.RuntimeConfig.Secrets.ResponsePath,\n\t\t})\n\t}\n\n\t// Configure the log pusher for the self-provisioned run. The run id is\n\t// the provisioning result's TestRunID.\n\tconfigureCloudLogPusher(gs, conf, strconv.FormatInt(result.TestRunID, 10))\n\n\t// Serialise overridden Config back into the collectors map (existing pattern).\n\traw, err := cloudConfToRawMessage(conf)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"could not serialize overridden cloud configuration: %w\", err)\n\t}\n\tif test.derivedConfig.Collectors == nil {\n\t\ttest.derivedConfig.Collectors = make(map[string]json.RawMessage)\n\t}\n\ttest.derivedConfig.Collectors[builtinOutputCloud.String()] = raw\n\n\treturn nil\n}\n\n// applyExternalProvisioningCreds handles the externally-provisioned\n// `--local-execution` flow, signalled by K6_CLOUD_PUSH_REF_ID: an external\n// service created and started the run and hands its scoped push credentials\n// to this local k6 via env. It reads K6_CLOUD_METRICS_PUSH_URL and\n// K6_CLOUD_TEST_RUN_TOKEN explicitly here — they are deliberately NOT\n// env-bound on cloudapi.Config, so a stray env var can never override the\n// values the self-provision flow obtains from the provisioning response.\n// It requires both-or-neither and, when both are present, sets them on conf\n// (so downstream consumers such as the log pusher see them) and bakes them","sourceCodeStart":173,"sourceCodeEnd":209,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/internal/cmd/outputs_cloud.go#L173-L209","documentation":"Generic wrap around serialization of the cloud configuration that the user overrode (env vars/flags) after provisioning. The %w carries the underlying marshal error; effectively an internal invariant failure since cloudapi.Config is plain serializable types.","triggerScenarios":"Thrown at internal/cmd/outputs_cloud.go:191 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the wrapped error for the failing field","Report as a k6 bug if it reproduces with normal cloud configuration"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"01ffac6f245854c1b8adc6a69857c76a15f90022","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":"2026-08-18T03:05:52.393Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}