{"record":{"id":"a38e70e4e9bde715","repo":"grafana/k6","slug":"provisioning-client-init-w","errorCode":null,"errorMessage":"provisioning client init: %w","messagePattern":"provisioning client init: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/output/cloud/output.go","lineNumber":557,"sourceCode":"\n\t// Lazy-construct the provisioning notifier (end-of-test notify).\n\t// Skipped when PushRefID is set: an external service owns the run\n\t// lifecycle, so k6 never notifies (testFinished returns early on\n\t// PushRefID) and the notifier would be unused. Invariant: a nil\n\t// notifier with provisioningMode true implies PushRefID is set.\n\tif out.provisioningNotifier == nil && !out.config.PushRefID.Valid {\n\t\t// The stack ID is required and passed as int64; provisioning.NewClient\n\t\t// enforces the int32 X-Stack-Id boundary internally.\n\t\tc, err := provisioning.NewClient(\n\t\t\tout.logger,\n\t\t\tout.config.Token.String, // long-lived k6 token (NOT scoped)\n\t\t\tout.config.Hostv6.String,\n\t\t\tbuild.Version,\n\t\t\tout.config.StackID.Int64,\n\t\t\tout.config.Timeout.TimeDuration(),\n\t\t)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"provisioning client init: %w\", err)\n\t\t}\n\t\tout.provisioningNotifier = c\n\t}\n\n\t// Both deps constructed; arm the gate.\n\tout.provisioningMode = true\n\n\treturn nil\n}\n","sourceCodeStart":539,"sourceCodeEnd":567,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/internal/output/cloud/output.go#L539-L567","documentation":"In provisioning mode (and without an external PushRefID owning the run lifecycle), lazyInitProvisioning lazily constructs the provisioning notifier client; provisioning.NewClient failed (e.g. invalid stack ID or client setup error) and is wrapped as the provisioning client init failure.","triggerScenarios":"Thrown at internal/output/cloud/output.go:557 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the wrapped error for the exact cause (commonly a missing/invalid provisioning stack ID or token)","Verify K6_CLOUD_* provisioning-related environment variables and credentials"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"01ffac6f245854c1b8adc6a69857c76a15f90022","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}