Skip to content

Workflow hangs when 'when' clause references skipped step outputs #15873

@KowalczykBartek

Description

@KowalczykBartek

Pre-requisites

  • I have double-checked my configuration
  • I have tested with the :latest image tag (i.e. quay.io/argoproj/workflow-controller:latest) and can confirm the issue still exists on :latest. If not, I have explained why, in detail, in my description below.
  • I have searched existing issues and could not find a match for this bug
  • I'd like to contribute the fix myself (see contributing guide) - ( I can try but needs to know if that is really an issue/bug)

What happened? What did you expect to happen?

Up to version 3.7.1

- - name: job2-error-handler
    arguments:
      parameters:
        - name: job-name
          value: "error-handler"
    templateRef:
      name: simple-job
      template: run-job
    when: "\"{{steps.job2.outputs.parameters.status}}\" != \"SUCCESS\" && \"{{steps.job1.outputs.parameters.status}}\" == \"SUCCESS\""

this step was correctly skipped,

steps.job2.outputs.parameters.status

was treat as an empty, after upgrading entire workflow hangs

STEP                       TEMPLATE            PODNAME                                               DURATION  MESSAGE
 ● requeue-bug-demo-wqcnr  main                                                                                                                          
 ├───✔ job1                simple-job/run-job  requeue-bug-demo-wqcnr-simple-job/run-job-1716469494  6s                                                  
 ├───○ job2                simple-job/run-job                                                                  when 'SUCCESS == FAILED' evaluated false  

Question is, is that a bug or previously it worked by accident ?

Version(s)

v3.7.12, dbb6c34

Paste a minimal workflow that reproduces the issue. We must be able to run the workflow; don't enter a workflow that uses private images.

---
# Simple template that returns a status
apiVersion: argoproj.io/v1alpha1
kind: WorkflowTemplate
metadata:
  name: simple-job
  namespace: argo
spec:
  templates:
    - name: run-job
      inputs:
        parameters:
          - name: job-name
      outputs:
        parameters:
          - name: status
            valueFrom:
              path: /tmp/status.txt
      script:
        image: python:alpine3.6
        command: [python]
        source: |
          with open('/tmp/status.txt', 'w') as f:
            f.write('SUCCESS')

---
apiVersion: argoproj.io/v1alpha1
kind: WorkflowTemplate
metadata:
  name: requeue-bug-demo
  namespace: argo
spec:
  entrypoint: main
  templates:
    - name: main
      steps:
        - - name: job1
            arguments:
              parameters:
                - name: job-name
                  value: "first-job"
            templateRef:
              name: simple-job
              template: run-job
        
        - - name: job2
            arguments:
              parameters:
                - name: job-name
                  value: "second-job"
            templateRef:
              name: simple-job
              template: run-job
            when: "{{steps.job1.outputs.parameters.status}} == FAILED"
        
        # CAUSES THE BUG
        - - name: job2-error-handler
            arguments:
              parameters:
                - name: job-name
                  value: "error-handler"
            templateRef:
              name: simple-job
              template: run-job
            when: "\"{{steps.job2.outputs.parameters.status}}\" != \"SUCCESS\" && \"{{steps.job1.outputs.parameters.status}}\" == \"SUCCESS\""

Logs from the workflow controller

[controller] (running)  time="2026-04-06T19:33:13.321Z" level=error msg="Failed to resolve references" error=requeue namespace=argo stepName=job2-error-handler workflow=requeue-bug-demo-7rbjj

Logs from in your workflow's wait container

there is no

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions