{"record":{"id":"a7c1c5733a526e83","repo":"kubernetes/kops","slug":"error-storing-instancegroup-v","errorCode":null,"errorMessage":"error storing InstanceGroup: %v","messagePattern":"error storing InstanceGroup: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/kops/create_instancegroup.go","lineNumber":295,"sourceCode":"\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error parsing yaml: %v\", err)\n\t\t}\n\t\tgroup, ok := obj.(*kopsapi.InstanceGroup)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"unexpected object type: %T\", obj)\n\t\t}\n\n\t\terr = validation.CrossValidateInstanceGroup(group, cluster, cloud, true).ToAggregate()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tig = group\n\t}\n\n\t_, err = clientset.InstanceGroupsFor(cluster).Create(ctx, ig, metav1.CreateOptions{})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error storing InstanceGroup: %v\", err)\n\t}\n\n\treturn nil\n}\n\nfunc completeClusterSubnet(f commandutils.Factory, excludeSubnets *[]string) func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {\n\treturn func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {\n\t\tctx := cmd.Context()\n\n\t\tcommandutils.ConfigureKlogForCompletion()\n\n\t\tcluster, _, completions, directive := GetClusterForCompletion(ctx, f, nil)\n\t\tif cluster == nil {\n\t\t\treturn completions, directive\n\t\t}\n\n\t\tif len(args) > 1 {\n\t\t\treturn commandutils.CompletionError(\"too many arguments\", nil)","sourceCodeStart":277,"sourceCodeEnd":313,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/cmd/kops/create_instancegroup.go#L277-L313","documentation":"Once validated, the InstanceGroup is persisted via clientset.InstanceGroupsFor(cluster).Create. If the kOps API (state store backend, e.g. S3-backed) fails to create the object, the underlying error is wrapped with this message. At this point the group definition is valid but was not saved, so the cluster state is unchanged.","triggerScenarios":"Calling Create on the InstanceGroup clientset when the state store is unreachable or read-only, the object already exists (AlreadyExists conflict), permissions are missing, or the context is cancelled.","commonSituations":"S3 bucket permissions changed or AWS credentials expired; kops state store (KOPS_STATE_STORE) pointing at a wrong/missing bucket; the InstanceGroup name already exists (use `kops update`/`kops edit` instead); network outage to the backend.","solutions":["Read the wrapped error: if it says already exists, the InstanceGroup name is taken — use `kops edit instancegroup` or delete and recreate","Verify KOPS_STATE_STORE is correct and the backend (S3/GCS/etc.) is reachable with valid credentials","Check IAM/bucket permissions for write access to the state store path","Retry after restoring network connectivity to the cloud storage backend","Run `kops get instancegroups` to confirm current state before retrying"],"exampleFix":"// before\nkops create instancegroup nodes --role Node  # AlreadyExists\n// after\nkops edit instancegroup nodes  # or kops delete instancegroup nodes first","handlingStrategy":"retry","validationCode":"kops get cluster \"$CLUSTER\" >/dev/null && kops get instancegroup -n \"$CLUSTER\" \"$IG_NAME\" 2>/dev/null && echo exists\n# also check state store reachability/credentials beforehand","typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"error storing InstanceGroup\") {\n\tif strings.Contains(err.Error(), \"already exists\") { /* switch to edit/update path */ } else { /* retry with backoff after checking state store access */ }\n}","preventionTips":["Validate state store access (KOPS_STATE_STORE, cloud credentials) before running","Check for existing InstanceGroups to avoid AlreadyExists conflicts","Use idempotent naming conventions in automation","Retry transient network failures with backoff"],"tags":["storage","state-store","api"],"backgroundTag":"instancegroup-create-failed","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"}