{"record":{"id":"f350608df08d5848","repo":"kubernetes/kubernetes","slug":"failed-to-parse-annotation-s-s-as-int64-v","errorCode":null,"errorMessage":"failed to parse annotation[%s]=%s as int64: %v","messagePattern":"failed to parse annotation\\[(.+?)\\]=(.+?) as int64: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"pkg/apis/apps/v1/conversion.go","lineNumber":48,"sourceCode":"// Convert_apps_DeploymentSpec_To_v1_DeploymentSpec is defined here, because public\n// conversion is not auto-generated due to existing warnings.\nfunc Convert_apps_DeploymentSpec_To_v1_DeploymentSpec(in *apps.DeploymentSpec, out *appsv1.DeploymentSpec, s conversion.Scope) error {\n\tif err := autoConvert_apps_DeploymentSpec_To_v1_DeploymentSpec(in, out, s); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}\n\nfunc Convert_v1_Deployment_To_apps_Deployment(in *appsv1.Deployment, out *apps.Deployment, s conversion.Scope) error {\n\tif err := autoConvert_v1_Deployment_To_apps_Deployment(in, out, s); err != nil {\n\t\treturn err\n\t}\n\n\t// Copy annotation to deprecated rollbackTo field for roundtrip\n\t// TODO: remove this conversion after we delete extensions/v1beta1 and apps/v1beta1 Deployment\n\tif revision := in.Annotations[appsv1.DeprecatedRollbackTo]; revision != \"\" {\n\t\tif revision64, err := strconv.ParseInt(revision, 10, 64); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to parse annotation[%s]=%s as int64: %v\", appsv1.DeprecatedRollbackTo, revision, err)\n\t\t} else {\n\t\t\tout.Spec.RollbackTo = new(apps.RollbackConfig)\n\t\t\tout.Spec.RollbackTo.Revision = revision64\n\t\t}\n\t\tout.Annotations = deepCopyStringMap(out.Annotations)\n\t\tdelete(out.Annotations, appsv1.DeprecatedRollbackTo)\n\t} else {\n\t\tout.Spec.RollbackTo = nil\n\t}\n\n\treturn nil\n}\n\nfunc Convert_apps_Deployment_To_v1_Deployment(in *apps.Deployment, out *appsv1.Deployment, s conversion.Scope) error {\n\tif err := autoConvert_apps_Deployment_To_v1_Deployment(in, out, s); err != nil {\n\t\treturn err\n\t}\n","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/kubernetes/kubernetes/blob/b882c60b4023bdf09264c2d5d30a2cadebc240fb/pkg/apis/apps/v1/conversion.go#L30-L66","documentation":"Convert_v1_Deployment_To_apps_Deployment reads the deprecated 'deployment.kubernetes.io/revision' annotation (DeprecatedRollbackTo) and parses it as an int64 to populate the internal RollbackTo field for round-trip conversion. This error fires when the annotation value is present but not a valid base-10 integer. It preserves legacy rollback semantics during conversion between external and internal types.","triggerScenarios":"A Deployment object carries the DeprecatedRollbackTo annotation with a non-numeric value, and a conversion from the external apps/v1 Deployment to the internal apps Deployment is performed (e.g. via the API server's scheme.Convert, kubectl, or any controller reading the object through the scheme).","commonSituations":"Manual annotation injection with a typo or a hash string instead of a revision number; a tool writing a semantic value (e.g. 'latest') into the annotation; stale objects from before the deprecation that got corrupted; migration scripts setting annotations incorrectly.","solutions":["Remove or correct the DeprecatedRollbackTo annotation so its value is a base-10 integer (the revision number) or empty.","If rollback is not intended, delete the annotation entirely: `kubectl annotate deployment <name> deployment.kubernetes.io/revision-`.","Patch the object with a valid revision integer if rollback semantics are needed.","Avoid writing this deprecated annotation in automation; it exists only for legacy round-trip compatibility."],"exampleFix":"// before: annotation set to a non-numeric value\nannotations[\"deployment.kubernetes.io/revision\"] = \"v2\"\n// after: valid integer revision or omit entirely\nannotations[\"deployment.kubernetes.io/revision\"] = \"2\"\n// or remove it\ndelete(annotations, \"deployment.kubernetes.io/revision\")","handlingStrategy":"validation","validationCode":"// Strip or validate the DeprecatedRollbackTo annotation before conversion\nif v, ok := annotations[appsv1.DeprecatedRollbackTo]; ok {\n    if _, err := strconv.ParseInt(v, 10, 64); err != nil {\n        delete(annotations, appsv1.DeprecatedRollbackTo) // or fix the value\n    }\n}","typeGuard":"func hasValidRollbackAnnotation(annotations map[string]string) bool {\n    v, ok := annotations[\"deployment.kubernetes.io/revision\"]\n    if !ok || v == \"\" { return true }\n    _, err := strconv.ParseInt(v, 10, 64)\n    return err == nil\n}","tryCatchPattern":"if err := scheme.Convert(in, out, nil); err != nil {\n    if strings.Contains(err.Error(), \"failed to parse annotation\") { /* fix/remove annotation and retry */ }\n}","preventionTips":["Do not write the DeprecatedRollbackTo annotation from new automation.","Validate annotation values as int64 before persisting if legacy support is required."],"tags":["apps","deployment","conversion","annotation","deprecated"],"analyzedSha":"b882c60b4023bdf09264c2d5d30a2cadebc240fb","analyzedAt":"2026-08-07T04:07:48.144Z","schemaVersion":2},"datasetVersion":"2026-08-07T07:17:06.508Z"}