tektoncd/pipeline

Runtime task result reference validation errors not exposed in pipeline status

Open

#9,100 opened on Oct 27, 2025

 (4 comments) (2 reactions) (1 assignee)Go (1,943 forks)auto 404
good first issuehelp wantedkind/bug

Repository metrics

Stars
 (9,013 stars)
PR merge metrics
 (PR metrics pending)

Description

Summary

When a Tekton pipeline fails due to missing task result references during runtime (after tasks have completed), the detailed error information is only available in reconciler logs at INFO level, not in the user-facing pipeline status/condition. This makes it difficult for users to diagnose the root cause of PipelineValidationFailed errors.

Expected Behavior

  • Pipeline status should include specific details about which task result reference failed
  • Error message should provide actionable information for debugging

Actual Behavior

  • Pipeline correctly fails with reason: PipelineValidationFailed
  • Status message shows generic count: "Tasks Completed: 2, Failed Validation: 1"
  • Detailed error ("Failed to resolve task result reference for taskX.resultY") only appears in reconciler logs at INFO level
  • Users must dig through reconciler logs to find the actual cause

Steps to Reproduce the Problem

  1. Create a pipeline with two tasks where:
    • Task A defines a result but fails to write the result value
    • Task B tries to consume Task A's result via $(tasks.taskA.results.resultName)
  2. Run the pipeline
  3. Check the pipeline status after Task A completes and Task B fails validation

Code Analysis

Issue Location: pkg/reconciler/pipelinerun/pipelinerun.go:890

  err := resources.CheckMissingResultReferences(pipelineRunFacts.State, rpt)
  if err != nil {
      logger.Infof("Failed to resolve task result reference for %q with error %v", pr.Name, err)  // ❌ Only logs to INFO
      nextRpts = nil
      logger.Infof("Adding the task %q to the validation failed list", rpt.ResolvedTask)
      pipelineRunFacts.ValidationFailedTask = append(pipelineRunFacts.ValidationFailedTask, rpt)  // ❌ No error details preserved
  }

  Status Message Generation: pkg/reconciler/pipelinerun/resources/pipelinerunstate.go:537-539

  if s.ValidationFailed > 0 {
      message += fmt.Sprintf(", Failed Validation: %d", s.ValidationFailed)  // ❌ Only includes count
  }

Root Cause

The runtime validation path (after tasks complete) differs from early validation:

  • Early validation (before any tasks run): Detailed errors included in status via pr.Status.MarkFailed(..., err.Error())
  • Runtime validation (after tasks complete): Only counts are aggregated, specific error details lost

Proposed Solution

  1. Preserve error details in ValidationFailedTask entries
  2. Include specific error messages in pipeline status when validation failures occur
  3. Consider using ERROR log level for validation failures instead of INFO

Example improved status message: "Tasks Completed: 2, Failed Validation: 1 (Failed to resolve task result reference: could not find result 'output' for pipeline task 'task-a')"

Impact

  • User Experience: Significantly improves debugging experience for common pipeline authoring mistakes
  • Support Burden: Reduces need for users to access reconciler logs for basic error diagnosis
  • Consistency: Aligns runtime validation error reporting with early validation error reporting

Additional Info

  • Kubernetes version:

    Output of kubectl version:

kubectl version
Client Version: v1.32.2
Kustomize Version: v5.5.0
Server Version: v1.32.9-eks-113cf36
  • Tekton Pipeline version:

    Output of tkn version or kubectl get pods -n tekton-pipelines -l app=tekton-pipelines-controller -o=jsonpath='{.items[0].metadata.labels.version}'

v1.1.0

Contributor guide