{"record":{"id":"5b33c0cd5df58542","repo":"kubernetes/kops","slug":"cannot-infer-cloud-provider-from-path-q","errorCode":null,"errorMessage":"cannot infer cloud provider from path: %q","messagePattern":"cannot infer cloud provider from path: %q","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/clouds/supported.go","lineNumber":74,"sourceCode":"\tcase strings.HasPrefix(path, \"hos://\"):\n\t\treturn kops.CloudProviderHetzner, nil\n\tcase strings.HasPrefix(path, \"gs://\"):\n\t\treturn kops.CloudProviderGCE, nil\n\tcase strings.HasPrefix(path, \"linode://\"):\n\t\treturn kops.CloudProviderLinode, nil\n\tcase strings.HasPrefix(path, \"scw://\"):\n\t\treturn kops.CloudProviderScaleway, nil\n\tcase strings.HasPrefix(path, \"swift://\"):\n\t\treturn kops.CloudProviderOpenstack, nil\n\tcase strings.HasPrefix(path, \"s3://\"):\n\t\tif os.Getenv(\"HCLOUD_TOKEN\") != \"\" {\n\t\t\treturn kops.CloudProviderHetzner, nil\n\t\t} else if os.Getenv(\"LINODE_TOKEN\") != \"\" {\n\t\t\treturn kops.CloudProviderLinode, nil\n\t\t}\n\t\treturn kops.CloudProviderAWS, nil\n\tdefault:\n\t\treturn \"\", fmt.Errorf(\"cannot infer cloud provider from path: %q\", path)\n\t}\n}\n","sourceCodeStart":56,"sourceCodeEnd":77,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/clouds/supported.go#L56-L77","documentation":"GuessCloudForPath infers the cloud provider from a VFS/URL path (e.g. s3://, gs://, ssh paths). When the path's scheme does not map to any supported provider it returns this error. It means kops cannot determine which cloud implementation to use for the given location.","triggerScenarios":"Calling GuessCloudForPath (directly or via NewCluster) with a path whose scheme is not recognized — e.g. file:///state, an HTTPS URL, a typo'd scheme (s4://), or an empty path.","commonSituations":"Creating/upgrading a cluster with a state store on an unsupported backend; typos in the -state flag; using OSS/Swift endpoints without the matching env config that the recognized branches check (e.g. OS_/AWS_ env vars).","solutions":["Use a supported state-store scheme (s3://, gs://, azure://, do://, hetzner://, openstack:// etc.) or a path whose env tokens identify the cloud.","Export the cloud-specific env var (e.g. AWS_PROFILE/credentials, OS_* for OpenStack) so the inference branch matches.","Pass the cloud provider explicitly to the command instead of relying on path inference."],"exampleFix":"// before\ncloud, err := GuessCloudForPath(\"https://my-bucket/state\")\n// after\ncloud, err := GuessCloudForPath(\"s3://my-bucket/state\")","handlingStrategy":"validation","validationCode":"u, err := url.Parse(path)\nif err != nil || u.Scheme == \"\" {\n  return fmt.Errorf(\"state store path %q must use a supported scheme (s3://, gs://, ...)\", path)\n}","typeGuard":null,"tryCatchPattern":"cloud, err := GuessCloudForPath(path)\nif err != nil {\n  return fmt.Errorf(\"could not infer cloud; pass --cloud or use a recognized state-store URL: %w\", err)\n}","preventionTips":["Always use documented state-store schemes (s3://, gs://, ...).","Set the cloud-specific env vars (AWS_*, OS_*, etc.) before commands relying on inference.","Pass the cloud provider explicitly rather than depending on path guessing."],"tags":["cloud-provider","vfs","inference","state-store"],"backgroundTag":"unsupported-path-scheme","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"}