{"record":{"id":"8bf802c0d15fa724","repo":"kubernetes/kops","slug":"error-parsing-last-kops-version-updated-v","errorCode":null,"errorMessage":"error parsing last kops version updated: %v","messagePattern":"error parsing last kops version updated: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/apply_cluster.go","lineNumber":283,"sourceCode":"\terr = c.validateKubernetesVersion()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcluster := c.Cluster\n\n\tconfigBase, err := c.Clientset.VFSContext().BuildVfsPath(cluster.Spec.ConfigStore.Base)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error parsing configStore.base %q: %v\", cluster.Spec.ConfigStore.Base, err)\n\t}\n\n\tif !c.AllowKopsDowngrade {\n\t\tkopsVersionUpdatedBytes, err := configBase.Join(registry.PathKopsVersionUpdated).ReadFile(ctx)\n\t\tif err == nil {\n\t\t\tkopsVersionUpdated := strings.TrimSpace(string(kopsVersionUpdatedBytes))\n\t\t\tversion, err := semver.Parse(kopsVersionUpdated)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"error parsing last kops version updated: %v\", err)\n\t\t\t}\n\t\t\tif version.GT(semver.MustParse(kopsbase.Version)) {\n\t\t\t\tfmt.Printf(\"\\n\")\n\t\t\t\tfmt.Printf(\"%s\\n\", starline)\n\t\t\t\tfmt.Printf(\"\\n\")\n\t\t\t\tfmt.Printf(\"The cluster was last updated by kops version %s\\n\", kopsVersionUpdated)\n\t\t\t\tfmt.Printf(\"To permit updating by the older version %s, run with the --allow-kops-downgrade flag\\n\", kopsbase.Version)\n\t\t\t\tfmt.Printf(\"\\n\")\n\t\t\t\tfmt.Printf(\"%s\\n\", starline)\n\t\t\t\tfmt.Printf(\"\\n\")\n\t\t\t\treturn nil, fmt.Errorf(\"kops version older than last used to update the cluster\")\n\t\t\t}\n\t\t} else if err != os.ErrNotExist {\n\t\t\treturn nil, fmt.Errorf(\"error reading last kops version used to update: %v\", err)\n\t\t}\n\t}\n\n\tcloud := c.Cloud","sourceCodeStart":265,"sourceCodeEnd":301,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/apply_cluster.go#L265-L301","documentation":"Unless --allow-kops-downgrade is set, Run() reads the kops-version-updated marker file from configBase and parses it as semver. If the marker file exists but its content cannot be parsed by go-semver, Run returns this error. The file is expected to hold a clean semver string like '1.29.2'.","triggerScenarios":"The file at <configBase>/kops-version-updated (registry.PathKopsVersionUpdated) contains garbage, extra non-semver text, an empty string, or a non-semver version (e.g. 'v1.2.3-alpha.0.615+cc55' variants with unsupported syntax, or truncation from a failed write).","commonSituations":"Corrupted state-store object from an interrupted upload; someone manually edited or echoed the marker; an object sync/backup tool mangled the file encoding (BOM, newlines+CRLF usually fine after TrimSpace, but embedded text breaks it).","solutions":["Inspect and fix the marker object in the state store: read <configBase>/kops-version-updated and replace its content with a valid semver (e.g. the kops version that last updated, like 1.29.2).","If the value is plausible but malformed, rewrite it with a supported semver via your cloud CLI (aws s3 cp, gcloud storage cp).","As a last resort delete the marker so kops recreates it, after confirming no real downgrade will occur (with --allow-kops-downgrade for the next run)."],"exampleFix":"// marker file content\n// before\n\"1.29.2-latest\"\n// after\n\"1.29.2\"","handlingStrategy":"type-guard","validationCode":"raw := strings.TrimSpace(string(markerBytes))\nif _, err := semver.Parse(raw); err != nil {\n    return fmt.Errorf(\"kops-version-updated marker malformed: %q\", raw)\n}","typeGuard":"func isValidKopsVersion(raw string) bool {\n    _, err := semver.Parse(strings.TrimSpace(raw))\n    return err == nil\n}","tryCatchPattern":null,"preventionTips":["Never hand-edit state-store marker objects.","Verify backup/sync tools do not transform object contents (encoding, BOM, concatenation).","Validate marker files with semver.Parse after any state-store restore."],"tags":["state-store","semver","versioning"],"backgroundTag":"semver-parse-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"}