kubernetes/kops · error

task %q not found

Error message

task %q not found

What it means

Returned by the template helper Task(typeName, name) when the constructed key typeName+"/"+name is not present in the task map. It fires when a CloudTemplate references a task that was never registered (wrong type name, wrong task name, or the producing task was skipped for this cloud provider), causing template rendering to fail.

Source

Thrown at upup/pkg/fi/cloudup/template_functions.go:539

func (tf *TemplateFunctions) taskMap() (map[string]fi.CloudupTask, error) {
	if tf.tasks == nil {
		return nil, fmt.Errorf("template tasks are not available during this render phase")
	}
	return tf.tasks, nil
}

// Task returns a task by type and name, for example Task "IAMRole" "nodes.example.com".
func (tf *TemplateFunctions) Task(typeName, name string) (fi.CloudupTask, error) {
	tasks, err := tf.taskMap()
	if err != nil {
		return nil, err
	}

	key := typeName + "/" + name
	task := tasks[key]
	if task == nil {
		return nil, fmt.Errorf("task %q not found", key)
	}
	return task, nil
}

// HasTask reports whether the named task exists in the final task graph.
func (tf *TemplateFunctions) HasTask(typeName, name string) bool {
	if tf.tasks == nil {
		return false
	}
	return tf.tasks[typeName+"/"+name] != nil
}

// TasksByType returns tasks of a specific type in deterministic task-key order.
func (tf *TemplateFunctions) TasksByType(typeName string) ([]fi.CloudupTask, error) {
	tasks, err := tf.taskMap()
	if err != nil {
		return nil, err
	}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Check the template for the exact Task type and name strings; they must match the registered task's type name and its name field
  2. Ensure the task being referenced is actually produced for the current cloud provider and lifecycle
  3. If the reference is optional, guard it in the template or use TasksMatching for prefix lookups
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at upup/pkg/fi/cloudup/template_functions.go:539 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/e6075fa4c6d9386a. Report an issue: GitHub.