Skip to content
Latchkey

Tekton "Pipeline X can't be Run; it has an invalid spec" in CI

Tekton validated the Pipeline spec and found an error: an invalid task graph, a missing taskRef, an undeclared workspace, or a bad result reference. The PipelineRun is Failed with reason PipelineValidationFailed.

What this error means

A PipelineRun fails with "Pipeline ci/release can't be Run; it has an invalid spec: invalid value: ...".

Tekton
Pipeline ci/release can't be Run; it has an invalid spec: invalid value: pipeline task build refers to non-existent task: spec.tasks[0].taskRef

Common causes

A task in the graph references something undefined

A pipeline task points at a taskRef, workspace, or result that does not exist, so the graph is invalid.

A dependency cycle or bad runAfter

Tasks that depend on each other in a cycle, or a runAfter naming a nonexistent task, make the DAG invalid.

How to fix it

Fix the path named in the message

  1. The message names a path like spec.tasks[0].taskRef.
  2. Correct the reference, workspace binding, or runAfter that it points to.
  3. Re-apply the Pipeline and re-run.
Terminal
kubectl apply --dry-run=server -f pipeline.yaml

Declare workspaces the tasks require

A pipeline task that uses a workspace must list it under the Pipeline's workspaces and map it in the task.

pipeline.yaml
spec:
  workspaces:
    - name: source
  tasks:
    - name: build
      workspaces:
        - name: source
          workspace: source

How to prevent it

  • Dry-run apply Pipelines in CI so invalid specs fail early.
  • Keep taskRefs, workspaces, and results consistent across the graph.
  • Avoid dependency cycles in runAfter and result references.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →