kubernetes/kops · error

function panic

Error message

function panic

What it means

A defensive placeholder written into the executor's results slot before a task goroutine runs: the value is pre-set to "function panic" so that if the task panics before producing a result, the slice still holds an error instead of nil. Seeing this error means a task goroutine panicked (and the recover path left this sentinel in place) — the real stack trace is in the logs.

Source

Thrown at upup/pkg/fi/executor.go:212

func (e *executor[T]) forkJoin(ctx context.Context, tasks []*taskState[T]) []error {
	if len(tasks) == 0 {
		return nil
	}

	results := make([]error, len(tasks))
	var resultsMutex sync.Mutex

	var wg sync.WaitGroup
	for i := 0; i < len(tasks); i++ {
		wg.Add(1)
		go func(ts *taskState[T], index int) {
			defer wg.Done()

			_, span := tracer.Start(ctx, "task-"+ts.key)
			defer span.End()

			resultsMutex.Lock()
			results[index] = fmt.Errorf("function panic")
			resultsMutex.Unlock()

			klog.V(2).Infof("Executing task %q: %v\n", ts.key, ts.task)

			if taskNormalize, ok := ts.task.(TaskNormalize[T]); ok {
				if err := taskNormalize.Normalize(e.context); err != nil {
					results[index] = err
					return
				}
			}

			result := ts.task.Run(e.context)

			resultsMutex.Lock()
			results[index] = result
			resultsMutex.Unlock()
		}(tasks[i], i)
	}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Search the kops log output above this error for the panic stack trace identifying the faulting task
  2. Fix the nil dereference/index-out-of-range in the task code shown by the stack
  3. Add defensive checks in task Run/Render methods for empty inputs that trigger the panic
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at upup/pkg/fi/executor.go:212 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/999ffa1dd161c7a4. Report an issue: GitHub.