{"record":{"id":"25542cf17958baaf","repo":"grafana/k6","slug":"could-not-serialize-cloud-configuration-w","errorCode":null,"errorMessage":"could not serialize cloud configuration: %w","messagePattern":"could not serialize cloud configuration: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/cmd/outputs_cloud.go","lineNumber":241,"sourceCode":"\ttoken := gs.Env[\"K6_CLOUD_TEST_RUN_TOKEN\"]\n\tif (pushURL == \"\") != (token == \"\") {\n\t\treturn errors.New(\"both K6_CLOUD_METRICS_PUSH_URL and \" +\n\t\t\t\"K6_CLOUD_TEST_RUN_TOKEN must be set together\")\n\t}\n\t// A logs push URL is authenticated with the same scoped token, so reject a\n\t// logs URL supplied without it rather than silently streaming nothing.\n\tif token == \"\" && conf.LogsPushURL.Valid && conf.LogsPushURL.String != \"\" {\n\t\treturn errors.New(\"K6_CLOUD_LOGS_PUSH_URL requires K6_CLOUD_TEST_RUN_TOKEN\")\n\t}\n\tif pushURL == \"\" {\n\t\treturn nil\n\t}\n\n\tconf.MetricsPushURL = null.StringFrom(pushURL)\n\tconf.TestRunToken = null.StringFrom(token)\n\traw, err := cloudConfToRawMessage(*conf)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"could not serialize 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\treturn nil\n}\n\n// externalLogsConfig mirrors the K6_CLOUD_LOGS_* env vars an external\n// orchestrator uses to hand the log-push settings to a local k6. These are\n// read explicitly (the Logs* fields are not env-bound on cloudapi.Config) so a\n// stray env value can't override the run-scoped logs config in the\n// self-provisioned flow.\ntype externalLogsConfig struct {\n\tPushURL       null.String        `envconfig:\"K6_CLOUD_LOGS_PUSH_URL\"`\n\tLevel         null.String        `envconfig:\"K6_CLOUD_LOGS_LEVEL\"`\n\tLimit         null.Int           `envconfig:\"K6_CLOUD_LOGS_LIMIT\"`\n\tPushPeriod    types.NullDuration `envconfig:\"K6_CLOUD_LOGS_PUSH_PERIOD\"`","sourceCodeStart":223,"sourceCodeEnd":259,"githubUrl":"https://github.com/grafana/k6/blob/93accf6570dcd306ca5e99cc44c393ee3797761b/internal/cmd/outputs_cloud.go#L223-L259","documentation":"Error \"could not serialize cloud configuration: %w\" thrown in grafana/k6.","triggerScenarios":"Thrown at internal/cmd/outputs_cloud.go:241 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"93accf6570dcd306ca5e99cc44c393ee3797761b","analyzedAt":"2026-08-15T21:23:27.118Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}