{"record":{"id":"4ca0b9ad6e148168","repo":"kubernetes/kops","slug":"pass-in-the-cloud-provider-explicitly-using-clou","errorCode":null,"errorMessage":"pass in the cloud provider explicitly using --cloud: %w","messagePattern":"pass in the cloud provider explicitly using --cloud: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/new_cluster.go","lineNumber":330,"sourceCode":"\t}\n\tcluster.Spec.API.Access = opt.AdminAccess\n\tif len(opt.SSHAccess) != 0 {\n\t\tcluster.Spec.SSHAccess = opt.SSHAccess\n\t} else {\n\t\tcluster.Spec.SSHAccess = opt.AdminAccess\n\t}\n\n\tif len(opt.Zones) == 0 {\n\t\treturn nil, fmt.Errorf(\"must specify at least one zone for the cluster (use --zones)\")\n\t}\n\tallZones := sets.NewString()\n\tallZones.Insert(opt.Zones...)\n\tallZones.Insert(opt.ControlPlaneZones...)\n\n\tif opt.CloudProvider == \"\" {\n\t\tcloud, err := clouds.GuessCloudForPath(cluster.Spec.ConfigStore.Base)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"pass in the cloud provider explicitly using --cloud: %w\", err)\n\t\t}\n\t\tklog.V(2).Infof(\"Inferred %q cloud provider from state store %q\", cloud, cluster.Spec.ConfigStore.Base)\n\t\topt.CloudProvider = string(cloud)\n\t}\n\n\tvar cloud fi.Cloud\n\n\tswitch api.CloudProviderID(opt.CloudProvider) {\n\tcase api.CloudProviderAWS:\n\t\tcluster.Spec.CloudProvider.AWS = &api.AWSSpec{}\n\t\tcloudTags := map[string]string{}\n\t\tawsCloud, err := awsup.NewAWSCloud(opt.Zones[0][:len(opt.Zones[0])-1], cloudTags)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tcloud = awsCloud\n\tcase api.CloudProviderAzure:\n\t\tcluster.Spec.CloudProvider.Azure = &api.AzureSpec{","sourceCodeStart":312,"sourceCodeEnd":348,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/new_cluster.go#L312-L348","documentation":"When --cloud is not specified, NewCluster tries clouds.GuessCloudForPath on the state-store path to infer the provider. If inference fails (path not recognizable as belonging to a cloud), it wraps the error with advice to pass --cloud explicitly.","triggerScenarios":"`kops create cluster` without --cloud and with a --state path (e.g. a generic vfs path, file:// store, or inaccessible S3 path) from which no cloud provider can be guessed.","commonSituations":"Using a file/memfs state store in tests; S3 state store where credentials prevent reading the path; users migrating configs to a neutral storage backend.","solutions":["Pass --cloud explicitly, e.g. --cloud aws (or gce, do, hetzner, openstack, azure, scaleway, linode, metal)","Set opt.CloudProvider in NewClusterOptions","Fix the state-store path/credentials so GuessCloudForPath can infer the provider"],"exampleFix":"// before\nkops create cluster --name c.example.com --zones us-east-1a --state vfs:///tmp/state\n// after\nkops create cluster --name c.example.com --cloud aws --zones us-east-1a --state vfs:///tmp/state","handlingStrategy":"validation","validationCode":"if opt.CloudProvider == \"\" {\n    return fmt.Errorf(\"--cloud is required when the state store path cannot be inferred\")\n}","typeGuard":null,"tryCatchPattern":"_, err := NewCluster(opt, cs)\nif err != nil && strings.Contains(err.Error(), \"pass in the cloud provider explicitly\") {\n    // set opt.CloudProvider and retry\n}","preventionTips":["Always pass --cloud explicitly in scripts","Use a cloud-specific state store (s3:// for AWS) so inference works","Fix state-store credentials so GuessCloudForPath can read the path"],"tags":["cloud-provider","inference","cli"],"backgroundTag":"ambiguous-cloud-provider","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T07:17:12.445Z"}