{"record":{"id":"29c821f0d9080fea","repo":"kubernetes/kops","slug":"error-reading-cluster-configuration-q-v","errorCode":null,"errorMessage":"error reading cluster configuration %q: %v","messagePattern":"error reading cluster configuration %q: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/client/simple/vfsclientset/cluster.go","lineNumber":194,"sourceCode":"\t\t}\n\t\tkey := strings.TrimSuffix(relativePath, \"/config\")\n\t\tkeys = append(keys, key)\n\t}\n\treturn keys, nil\n}\n\nfunc (r *ClusterVFS) find(ctx context.Context, clusterName string) (*api.Cluster, error) {\n\tif clusterName == \"\" {\n\t\treturn nil, fmt.Errorf(\"clusterName is required\")\n\t}\n\tconfigPath := r.basePath.Join(clusterName, registry.PathCluster)\n\n\to, err := r.readConfig(ctx, configPath)\n\tif err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\treturn nil, nil\n\t\t}\n\t\treturn nil, fmt.Errorf(\"error reading cluster configuration %q: %v\", clusterName, err)\n\t}\n\n\tc := o.(*api.Cluster)\n\n\tif c.ObjectMeta.Name == \"\" {\n\t\tc.ObjectMeta.Name = clusterName\n\t}\n\tif c.ObjectMeta.Name != clusterName {\n\t\tklog.Warningf(\"Name of cluster does not match: actual name was %q, but cluster name was %q (using registry path %v).\", c.ObjectMeta.Name, clusterName, registry.PathCluster)\n\t}\n\n\t// TODO: Split this out into real version updates / schema changes\n\tif c.Spec.ConfigStore.Base == \"\" {\n\t\tconfigBase, err := r.configBase(clusterName)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error building ConfigStore.Base for cluster: %v\", err)\n\t\t}\n\t\tc.Spec.ConfigStore.Base = configBase.Path()","sourceCodeStart":176,"sourceCodeEnd":212,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/client/simple/vfsclientset/cluster.go#L176-L212","documentation":"ClusterVFS.find found a config file at basePath/<name>/pki/cluster but readConfig failed with a non-IsNotExist error (parse failure, permission, backend error). Not-exist is treated as 'cluster absent' (nil,nil), so this error means the cluster exists but its config could not be read/decoded.","triggerScenarios":"Corrupted or partially-written cluster config in the state store; unsupported schema/store version; permission denied on the object; transient backend errors.","commonSituations":"Interrupted kops create leaving truncated YAML/JSON; manually edited cluster config; state store written by a newer kops with a schema the current binary cannot decode; object-lock/permission changes on the bucket.","solutions":["Inspect the wrapped %v cause to distinguish decode vs permission vs backend error","Restore the cluster config from backup or re-create the cluster config (kops replace/get --full to compare)","Upgrade/downgrade kops so the store schema version matches the binary","Fix bucket/object permissions on basePath/<name>/pki/cluster"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// check the config object exists and is readable before full parse\np := basePath.Join(name, registry.PathCluster)\ndata, err := p.ReadFile()\nif err != nil { return err }\nif len(bytes.TrimSpace(data)) == 0 {\n\treturn fmt.Errorf(\"cluster config for %q is empty/corrupt\", name)\n}","typeGuard":null,"tryCatchPattern":"cluster, err := clusterVFS.Get(ctx, name, metav1.GetOptions{})\nif err != nil && strings.Contains(err.Error(), \"error reading cluster configuration\") {\n\t// distinguish corrupt config from transient backend error\n\tif _, rerr := configPath.ReadFile(); rerr == nil {\n\t\treturn fmt.Errorf(\"cluster config for %q is corrupt or undecodable; restore from backup\", name)\n\t}\n\treturn fmt.Errorf(\"transient backend error reading %q: %w\", name, err)\n}","preventionTips":["Never hand-edit the raw cluster config in the state store","Avoid interrupting kops create/update mid-write","Keep kops version compatible with the store's StoreVersion","Back up state store contents before migration"],"tags":["go","vfs","storage","deserialization"],"backgroundTag":"cluster-config-unreadable","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"}