{"record":{"id":"878dd63f786eac36","repo":"kubernetes/kops","slug":"error-querying-cluster-q-v","errorCode":null,"errorMessage":"error querying cluster %q: %v","messagePattern":"error querying cluster %q: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/kops/create.go","lineNumber":163,"sourceCode":"\t\t\t\t_, err = clientset.CreateCluster(ctx, v)\n\t\t\t\tif err != nil {\n\t\t\t\t\tif apierrors.IsAlreadyExists(err) {\n\t\t\t\t\t\treturn fmt.Errorf(\"cluster %q already exists\", v.ObjectMeta.Name)\n\t\t\t\t\t}\n\t\t\t\t\treturn fmt.Errorf(\"error creating cluster: %v\", err)\n\t\t\t\t}\n\t\t\t\tfmt.Fprintf(&sb, \"Created cluster/%s\\n\", v.ObjectMeta.Name)\n\t\t\t\tclusters = append(clusters, v)\n\t\t\t\t// cSpec = true\n\n\t\t\tcase *kopsapi.InstanceGroup:\n\t\t\t\tclusterName = v.ObjectMeta.Labels[kopsapi.LabelClusterName]\n\t\t\t\tif clusterName == \"\" {\n\t\t\t\t\treturn fmt.Errorf(\"must specify %q label with cluster name to create instanceGroup\", kopsapi.LabelClusterName)\n\t\t\t\t}\n\t\t\t\tcluster, err := clientset.GetCluster(ctx, clusterName)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"error querying cluster %q: %v\", clusterName, err)\n\t\t\t\t}\n\n\t\t\t\tif cluster == nil {\n\t\t\t\t\treturn fmt.Errorf(\"cluster %q not found\", clusterName)\n\t\t\t\t}\n\n\t\t\t\t_, err = clientset.InstanceGroupsFor(cluster).Create(ctx, v, metav1.CreateOptions{})\n\t\t\t\tif err != nil {\n\t\t\t\t\tif apierrors.IsAlreadyExists(err) {\n\t\t\t\t\t\treturn fmt.Errorf(\"instanceGroup %q already exists\", v.ObjectMeta.Name)\n\t\t\t\t\t}\n\t\t\t\t\treturn fmt.Errorf(\"error creating instanceGroup: %v\", err)\n\t\t\t\t}\n\t\t\t\tfmt.Fprintf(&sb, \"Created instancegroup/%s\\n\", v.ObjectMeta.Name)\n\n\t\t\tcase *kopsapi.SSHCredential:\n\t\t\t\tclusterName = v.ObjectMeta.Labels[kopsapi.LabelClusterName]\n\t\t\t\tif clusterName == \"\" {","sourceCodeStart":145,"sourceCodeEnd":181,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/cmd/kops/create.go#L145-L181","documentation":"After reading the cluster-name label from an InstanceGroup, RunCreate calls clientset.GetCluster to fetch the parent cluster. If that backend lookup returns an error (storage/backend failure, not the not-found case), it is wrapped in this message with the cluster name and underlying error.","triggerScenarios":"`kops create -f ig.yaml` with a properly labeled InstanceGroup where GetCluster against the state store fails — e.g. unreachable/misspelled KOPS_STATE_STORE, bad credentials, malformed s3:// path, or network/permission error reading the cluster manifest.","commonSituations":"KOPS_STATE_STORE env var wrong or unset in CI; S3 bucket deleted or IAM permissions revoked; using a state store path for a different region; VPN/network outage on a developer machine.","solutions":["Read the wrapped %v detail to identify the backend failure","Verify KOPS_STATE_STORE points at the correct store (e.g. s3://<bucket>) and credentials work (`aws s3 ls $KOPS_STATE_STORE`)","Confirm the cluster manifest exists in the store (`kops get clusters`)","Retry after fixing network/permissions"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if os.Getenv(\"KOPS_STATE_STORE\") == \"\" {\n    return fmt.Errorf(\"KOPS_STATE_STORE must be set\")\n}\n// pre-check backend reachability\nif _, err := clientset.GetCluster(ctx, name); err != nil {\n    return fmt.Errorf(\"state store unreachable: %v\", err)\n}","typeGuard":null,"tryCatchPattern":"if err := runCreate(); err != nil {\n    var se *StateStoreError\n    if strings.Contains(err.Error(), \"error querying cluster\") {\n        // check KOPS_STATE_STORE, credentials, network, then retry\n    }\n}","preventionTips":["Pin KOPS_STATE_STORE in CI and shell profiles","Verify cloud credentials before kops create runs","Test state store access with `kops get clusters` first"],"tags":["kops","cli","state-store","cluster-lookup"],"backgroundTag":"state-store-unavailable","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"}