argo-workflows icon indicating copy to clipboard operation
argo-workflows copied to clipboard

Passing an output parameter from a template into a templateRef input fails with a `failed to resolve` error.

Open Jamozed opened this issue 11 months ago • 4 comments

Pre-requisites

  • [x] I have double-checked my configuration
  • [x] 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.
  • [x] 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)

What happened? What did you expect to happen?

Passing an output parameter from a template into a templateRef input argument fails with Bad Request: templates.main.steps[1].debug templates.debug: failed to resolve {{steps.generate-volume.outputs.parameters.pvc-name}}.

The supposedly invalid template used to work, and works when the templateRef is replaced with a template from the same file. It also worked briefly on retry when it initially stopped working (perhaps we were still running an old version of the web UI, if that is relevant), but on latest a workflow doesn't even get created before it fails.

Version(s)

86e51da260cf08708ef1debcb8af6bb373c93492635ce74c434f1012de58af08

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.

apiVersion: argoproj.io/v1alpha1
kind: WorkflowTemplate
metadata:
  name: outer
spec:
  entrypoint: main
  templates:
    - name: main
      steps:
        - - name: generate-volume
            template: generate-volume
        - - name: debug
            templateRef:
              name: inner
              template: debug
            arguments:
              parameters:
                - name: pvc-name
                  value: "{{steps.generate-volume.outputs.parameters.pvc-name}}"

    - name: generate-volume
      resource:
        action: create
        setOwnerReference: true
        manifest: |
          apiVersion: v1
          kind: PersistentVolumeClaim
          metadata:
            generateName: asset-volume-
          spec:
            accessModes: ["ReadWriteOnce"]
            resources:
              requests:
                storage: 1Ti
      outputs:
        parameters:
          - name: pvc-name
            valueFrom:
              jsonPath: "{.metadata.name}"
---
apiVersion: argoproj.io/v1alpha1
kind: WorkflowTemplate
metadata:
  name: inner
spec:
  templates:
    - name: debug
      inputs:
        parameters:
          - name: pvc-name
      container:
        image: busybox
        command: ["echo"]
        args:
          - "{{inputs.parameters.pvc-name}}"
        resources:
        volumeMounts:
          - name: asset-volume
            mountPath: /working
      volumes:
        - name: asset-volume
          persistentVolumeClaim:
            claimName: "{{inputs.parameters.pvc-name}}"

Logs from the workflow controller

N/A workflow cannot be created.

Logs from in your workflow's wait container

N/A workflow cannot be created.

Jamozed avatar Jan 26 '25 08:01 Jamozed

I came across the same issue, it seems that if you remove prefix {{ and postfix }} in arguments value string, template is accepted and executed successfully.

agrfj avatar Feb 13 '25 14:02 agrfj

I can see the same defect in v3.5.15 and the latest code in branch release-3.5. It is OK with v3.5.13.

I see it also in v3.6.10.

dongyingbo avatar Jul 04 '25 10:07 dongyingbo

Hi @Joibel , My you have a look at it please? Our existing workflows are broken after upgrading.

Thanks a lot!

dongyingbo avatar Jul 08 '25 01:07 dongyingbo

I can not reproducer it in v3.6.13.

dongyingbo avatar Nov 27 '25 06:11 dongyingbo

I came across the same issue, it seems that if you remove prefix {{ and postfix }} in arguments value string, template is accepted and executed successfully.

This did the trick for me - on chart 0.42.7 using manually set version v3.5.14. Note that in my case, the workflow was defined like :

apiVersion: argoproj.io/v1alpha1
kind: WorkflowTemplate
metadata:
  name: outer
spec:
  entrypoint: main
  templates:
    - name: main
      steps:
        - - name: generate-volume
            templateRef:
              name: another-template-ref-name
              template: template-inside-referenced-template
        - - name: debug
            templateRef:
              name: inner
              template: debug
            arguments:
              parameters:
                - name: pvc-name
                  value: "{{steps.generate-volume.outputs.parameters.pvc-name}}"

(double templateRefs)

Would love to know if this is a syntax thing I missed in the docs, or if this is indeed a bug

cchanche avatar Dec 10 '25 08:12 cchanche