{"record":{"id":"0f9c737f3966ee48","repo":"kubernetes/kops","slug":"task-does-not-have-a-lifecycle-set","errorCode":null,"errorMessage":"task does not have a lifecycle set","messagePattern":"task does not have a lifecycle set","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/default_methods.go","lineNumber":55,"sourceCode":"}\n\n// CloudupDefaultDeltaRunMethod implements the standard change-based run procedure:\n// find the existing item; compare properties; call render with (actual, expected, changes)\nfunc CloudupDefaultDeltaRunMethod(e CloudupTask, c *CloudupContext) error {\n\treturn defaultDeltaRunMethod[CloudupSubContext](e, c)\n}\n\n// defaultDeltaRunMethod implements the standard change-based run procedure:\n// find the existing item; compare properties; call render with (actual, expected, changes)\nfunc defaultDeltaRunMethod[T SubContext](e Task[T], c *Context[T]) error {\n\tvar a Task[T]\n\tvar err error\n\n\tlifecycle := LifecycleSync\n\tif hl, ok := e.(HasLifecycle); ok {\n\t\tlifecycle = hl.GetLifecycle()\n\t\tif lifecycle == \"\" {\n\t\t\treturn fmt.Errorf(\"task does not have a lifecycle set\")\n\t\t}\n\t}\n\n\tif lifecycle == LifecycleIgnore {\n\t\treturn nil\n\t}\n\n\tcheckExisting := c.Target.DefaultCheckExisting()\n\tif hce, ok := e.(HasCheckExisting[T]); ok {\n\t\tcheckExisting = hce.CheckExisting(c)\n\t}\n\n\tif checkExisting {\n\t\ta, err = invokeFind(e, c)\n\t\tif err != nil {\n\t\t\tif lifecycle == LifecycleWarnIfInsufficientAccess {\n\t\t\t\t// For now we assume all errors are permissions problems\n\t\t\t\t// TODO: bounded retry?","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/default_methods.go#L37-L73","documentation":"A lifecycle guard inside defaultDeltaRunMethod: before running the find/compare/render procedure, the task's Lifecycle field must be set (fi.Exists, fi.Ignore, or fi.CreateThenDelete etc.). A nil Lifecycle means the task struct was built without its lifecycle populated — a programming/setup error in the task definition, not a user input problem.","triggerScenarios":"Thrown at upup/pkg/fi/default_methods.go:55 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set the Lifecycle field when constructing the task (typically from the model builder, e.g. fi.PointerTo(fi.LifecycleExists))","Check the task's CompareWith/normalization path did not drop lifecycle during cloning","Add a validation in the task's CheckChanges so this surfaces earlier with context"],"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-12T12:17:11.808Z"}