{"record":{"id":"8f421c61496d2aca","repo":"kubernetes/kops","slug":"error-writing-updated-configuration-v","errorCode":null,"errorMessage":"error writing updated configuration: %v","messagePattern":"error writing updated configuration: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"cmd/kops/create_cluster.go","lineNumber":827,"sourceCode":"\t\tcase OutputYaml:\n\t\t\tif err := fullOutputYAML(out, obj...); err != nil {\n\t\t\t\treturn fmt.Errorf(\"error writing cluster yaml to stdout: %v\", err)\n\t\t\t}\n\t\t\treturn nil\n\t\tcase OutputJSON:\n\t\t\tif err := fullOutputJSON(out, true, obj...); err != nil {\n\t\t\t\treturn fmt.Errorf(\"error writing cluster json to stdout: %v\", err)\n\t\t\t}\n\t\t\treturn nil\n\t\tdefault:\n\t\t\treturn fmt.Errorf(\"unsupported output type %q\", c.Output)\n\t\t}\n\t}\n\n\t// Note we perform as much validation as we can, before writing a bad config\n\terr = registry.CreateClusterConfig(ctx, clientset, cluster, instanceGroups, addons)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error writing updated configuration: %v\", err)\n\t}\n\n\tif len(c.SSHPublicKeys) == 0 {\n\t\tautoloadSSHPublicKeys := true\n\t\tswitch c.CloudProvider {\n\t\tcase \"gce\", \"aws\":\n\t\t\tautoloadSSHPublicKeys = false\n\t\t}\n\n\t\tif autoloadSSHPublicKeys {\n\t\t\t// Load from default locations, if found\n\t\t\tsshPublicKeyPaths := []string{\n\t\t\t\t\"~/.ssh/id_ed25519.pub\",\n\t\t\t\t\"~/.ssh/id_rsa.pub\",\n\t\t\t}\n\t\t\tvar merr error\n\t\t\tfor _, sshPublicKeyPath := range sshPublicKeyPaths {\n\t\t\t\tc.SSHPublicKeys, err = loadSSHPublicKeys(sshPublicKeyPath)","sourceCodeStart":809,"sourceCodeEnd":845,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/cmd/kops/create_cluster.go#L809-L845","documentation":"RunCreateCluster persists the cluster config, instance groups, and addons via registry.CreateClusterConfig. If that write to the state store fails, the command aborts with this wrapped error. Because this is the first real write, it typically surfaces state-store access problems (bad --state location, credentials, network).","triggerScenarios":"`kops create cluster` where the state store (S3/GCS/VFS) rejects the write: bucket missing, insufficient permission, state store unreachable, or a conflicting object at the cluster location.","commonSituations":"Wrong --state flag or KOPS_STATE_STORE env var; IAM credentials lacking s3:PutObject; bucket in a different region requiring a region flag; cluster name collision with an existing cluster.","solutions":["Read the wrapped %v for the storage-layer cause (permissions, not found, etc.).","Verify --state / KOPS_STATE_STORE points at an existing, writable location.","Check cloud credentials (aws sts get-caller-identity / gsutil ls).","Run `kops get clusters` against the same state store to check for a name collision.","Retry on transient network errors."],"exampleFix":"// before\nexport KOPS_STATE_STORE=s3://nonexistent-bucket\nkops create cluster ...\n// after\naws s3 mb s3://my-kops-state-store\nexport KOPS_STATE_STORE=s3://my-kops-state-store\nkops create cluster ...","handlingStrategy":"validation","validationCode":"if os.Getenv(\"KOPS_STATE_STORE\") == \"\" && stateStore == \"\" {\n\treturn fmt.Errorf(\"state store not configured\")\n}\n// e.g. for s3: verify bucket exists and is writable before create\nif strings.HasPrefix(stateStore, \"s3://\") {\n\tbucket := strings.TrimPrefix(stateStore, \"s3://\")\n\tif err := checkS3BucketWritable(bucket); err != nil {\n\t\treturn err\n\t}\n}","typeGuard":null,"tryCatchPattern":"if err := runCreateCluster(...); err != nil {\n\tif strings.Contains(err.Error(), \"error writing updated configuration\") {\n\t\t// check state-store credentials/bucket, possibly retry on transient errors\n\t}\n\treturn err\n}","preventionTips":["Set and export KOPS_STATE_STORE in shell profiles and CI.","Verify bucket existence and IAM write permissions before running kops.","Run `kops get clusters` first to catch name collisions early.","Use unique cluster names per environment to avoid state conflicts.","Retry once on transient network/storage errors."],"tags":["cli","state-store","persistence"],"backgroundTag":"state-store-write-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"}