{"record":{"id":"50ad6e1e3334a30d","repo":"grafana/k6","slug":"failed-to-initialize-cloud-secret-source-w","errorCode":null,"errorMessage":"failed to initialize cloud secret source: %w","messagePattern":"failed to initialize cloud secret source: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/cmd/root.go","lineNumber":548,"sourceCode":"\tif len(result) == 1 {\n\t\tfor _, l := range result {\n\t\t\tresult[\"default\"] = l\n\t\t}\n\t}\n\n\t// Capture the cloud source instance if it was registered (via local-execution auto-injection\n\t// or the env-var path below), so createCloudTest can call SetConfig on it later.\n\tif cs, ok := result[\"cloud\"].(*cloudsecrets.SecretSource); ok {\n\t\tgs.CloudSecretSource = cs\n\t}\n\n\t// When  K6_CLOUD_SECRETS_TOKEN + K6_CLOUD_SECRETS_ENDPOINT are injected, create and configure the cloud source\n\t// directly from env vars without a /v1/tests round-trip. Set it as the default source if none was chosen.\n\tif token := gs.Env[\"K6_CLOUD_SECRETS_TOKEN\"]; token != \"\" {\n\t\tif gs.CloudSecretSource == nil {\n\t\t\tcloudSource, err := cloudsecrets.New(baseParams)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"failed to initialize cloud secret source: %w\", err)\n\t\t\t}\n\t\t\tresult[\"cloud\"] = cloudSource\n\t\t\tgs.CloudSecretSource = cloudSource\n\t\t}\n\t\tgs.CloudSecretSource.SetConfig(&cloudsecrets.Config{\n\t\t\tToken:        token,\n\t\t\tEndpoint:     gs.Env[\"K6_CLOUD_SECRETS_ENDPOINT\"],\n\t\t\tResponsePath: gs.Env[\"K6_CLOUD_SECRETS_RESPONSE_PATH\"],\n\t\t})\n\t\tif _, ok := result[\"default\"]; !ok {\n\t\t\tresult[\"default\"] = gs.CloudSecretSource\n\t\t}\n\t}\n\n\treturn result, nil\n}\n\n// isCloudRunWithLocalExecution returns true when the command being executed is","sourceCodeStart":530,"sourceCodeEnd":566,"githubUrl":"https://github.com/grafana/k6/blob/93accf6570dcd306ca5e99cc44c393ee3797761b/internal/cmd/root.go#L530-L566","documentation":"Error \"failed to initialize cloud secret source: %w\" thrown in grafana/k6.","triggerScenarios":"Thrown at internal/cmd/root.go:548 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"}