{"record":{"id":"1d30143cdb4ba36f","repo":"kubernetes/kops","slug":"error-parsing-config-s","errorCode":null,"errorMessage":"error parsing config: %s","messagePattern":"error parsing config: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/kops/edit_cluster.go","lineNumber":204,"sourceCode":"\t\tif bytes.Equal(stripComments(raw), stripComments(edited)) {\n\t\t\ttry.RemoveFile(file)\n\t\t\tfmt.Fprintln(out, \"Edit cancelled: no changes made.\")\n\t\t\treturn nil\n\t\t}\n\n\t\tlines, err := hasLines(bytes.NewBuffer(edited))\n\t\tif err != nil {\n\t\t\treturn preservedFile(err, file, out)\n\t\t}\n\t\tif !lines {\n\t\t\ttry.RemoveFile(file)\n\t\t\tfmt.Fprintln(out, \"Edit cancelled: saved file was empty.\")\n\t\t\treturn nil\n\t\t}\n\n\t\tnewObj, _, err := kopscodecs.Decode(edited, nil)\n\t\tif err != nil {\n\t\t\treturn preservedFile(fmt.Errorf(\"error parsing config: %s\", err), file, out)\n\t\t}\n\n\t\tnewCluster, ok := newObj.(*api.Cluster)\n\t\tif !ok {\n\t\t\tresults = editResults{\n\t\t\t\tfile: file,\n\t\t\t}\n\t\t\tresults.header.addError(fmt.Sprintf(\"object was not of expected type: %T\", newObj))\n\t\t\tcontainsError = true\n\t\t\tcontinue\n\t\t}\n\n\t\textraFields, err := edit.HasExtraFields(string(edited))\n\t\tif err != nil {\n\t\t\tresults = editResults{\n\t\t\t\tfile: file,\n\t\t\t}\n\t\t\tresults.header.addError(fmt.Sprintf(\"error checking for extra fields: %v\", err))","sourceCodeStart":186,"sourceCodeEnd":222,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/cmd/kops/edit_cluster.go#L186-L222","documentation":"After the editor round-trip, RunEditCluster decodes the edited bytes with the kops codecs; this fires when the edited YAML/JSON no longer parses into a known kops object. The edited temp file is preserved and the error is surfaced in the next edit round's header.","triggerScenarios":"Thrown at cmd/kops/edit_cluster.go:204 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the YAML syntax or apiVersion/kind in the preserved edit file","Ensure the document is a valid Cluster object","Avoid changing apiVersion/kind when editing"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}