kubernetes/kops · error

task does not have a lifecycle set

Error message

task does not have a lifecycle set

What it means

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.

Source

Thrown at upup/pkg/fi/default_methods.go:55

}

// CloudupDefaultDeltaRunMethod implements the standard change-based run procedure:
// find the existing item; compare properties; call render with (actual, expected, changes)
func CloudupDefaultDeltaRunMethod(e CloudupTask, c *CloudupContext) error {
	return defaultDeltaRunMethod[CloudupSubContext](e, c)
}

// defaultDeltaRunMethod implements the standard change-based run procedure:
// find the existing item; compare properties; call render with (actual, expected, changes)
func defaultDeltaRunMethod[T SubContext](e Task[T], c *Context[T]) error {
	var a Task[T]
	var err error

	lifecycle := LifecycleSync
	if hl, ok := e.(HasLifecycle); ok {
		lifecycle = hl.GetLifecycle()
		if lifecycle == "" {
			return fmt.Errorf("task does not have a lifecycle set")
		}
	}

	if lifecycle == LifecycleIgnore {
		return nil
	}

	checkExisting := c.Target.DefaultCheckExisting()
	if hce, ok := e.(HasCheckExisting[T]); ok {
		checkExisting = hce.CheckExisting(c)
	}

	if checkExisting {
		a, err = invokeFind(e, c)
		if err != nil {
			if lifecycle == LifecycleWarnIfInsufficientAccess {
				// For now we assume all errors are permissions problems
				// TODO: bounded retry?

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Set the Lifecycle field when constructing the task (typically from the model builder, e.g. fi.PointerTo(fi.LifecycleExists))
  2. Check the task's CompareWith/normalization path did not drop lifecycle during cloning
  3. Add a validation in the task's CheckChanges so this surfaces earlier with context
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at upup/pkg/fi/default_methods.go:55 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05). Data as JSON: /api/errors/0f9c737f3966ee48. Report an issue: GitHub.