argoproj / argoproj/argo-workflows
Unexpected end of json when using withParam
- Dominant language
- Go
- Stars
- 17k
- Forks
- 3.7k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 138
Description
### Pre-requisites
- [X] I have double-checked my configuration
- [X] I can confirm the issues exists when I tested with `:latest`
- [ ] I'd like to contribute the fix myself (see [contributing guide](https://github.com/argoproj/argo-workflows/blob/master/docs/CONTRIBUTING.md))
### What happened/what you expected to happen?
I created a workflow using the http template, and used withparam to parameterize the urls that i wanted to check. After running the workflow, the subtasks succeed, but the main task fails. The message displayed in the UI says:
unexpected end of JSON input.
If i create a similar workflow, but write each url as a separate step, everything runs fine
### Version
v3.3.4
### Paste a small workflow that reproduces the issue. We must be able to run the workflow; don't enter a workflows that uses private images.
```YAML
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: check-http-
namespace: argo-workflows
spec:
entrypoint: main
arguments:
parameters:
- name: urls
value: |
[
{"url": "https://google.com"},
{"url": "https://github.com"}
]
templates:
- name: main
inputs:
parameters:
- name: urls
dag:
tasks:
- name: check-url
withParam: "{{inputs.parameters.urls}}"
template: http
arguments:
parameters:
- name: url
value: '{{item.url}}'
- name: http
inputs:
parameters:
- name: url
http:
url: "{{inputs.parameters.url}}"
successCondition: "response.statusCode == 200"
method: "GET"
```
### Logs from the workflow controller
```text
time="2023-01-15T06:53:13.451Z" level=info msg="Processing workflow" namespace=argo-workflows workflow=check-http-v46n4
time="2023-01-15T06:53:13.458Z" level=info msg="Updated phase -> Running" namespace=argo-workflows workflow=check-http-v46n4
time="2023-01-15T06:53:13.459Z" level=info msg="DAG node check-http-v46n4 initialized Running" namespace=argo-workflows workflow=check-http-v46n4
time="2023-01-15T06:53:13.472Z" level=info msg="TaskGroup node check-http-v46n4-1174646707 initialized Running (message: )" namespace=argo-workflows workflow=check-http-v46n4
time="2023-01-15T06:53:13.472Z" level=info msg="All of node check-http-v46n4.check-url(0:url:https://google.com) dependencies [] completed" namespace=argo-workflows workflow=check-http-v46n4
time="2023-01-15T06:53:13.472Z" level=info msg="HTTP node check-http-v46n4-1765540512 initialized Pending" namespace=argo-workflows workflow=check-http-v46n4
time="2023-01-15T06:53:13.472Z" level=info msg="All of node check-http-v46n4.check-url(1:url:https://github.com) dependencies [] completed" namespace=argo-workflows workflow=check-http-v46n4
time="2023-01-15T06:53:13.472Z" level=info msg="HTTP node check-http-v46n4-792432315 initialized Pending" namespace=argo-workflows workflow=check-http-v46n4
time="2023-01-15T06:53:13.472Z" level=info msg="TaskSet Reconciliation" namespace=argo-workflows workflow=check-http-v46n4
time="2023-01-15T06:53:13.472Z" level=info msg="Creating TaskSet" namespace=argo-workflows workflow=check-http-v46n4
time="2023-01-15T06:53:13.505Z" level=info msg=reconcileAgentPod namespace=argo-workflows workflow=check-http-v46n4
time="2023-01-15T06:53:13.589Z" level=info msg="Created Agent pod" namespace=argo-workflows podName=check-http-v46n4-1340600742-agent workflow=check-http-v46n4
time="2023-01-15T06:53:13.589Z" level=info msg=updateAgentPodStatus namespace=argo-workflows workflow=check-http-v46n4
time="2023-01-15T06:53:13.589Z" level=info msg=assessAgentPodStatus namespace=argo-workflows podName=check-http-v46n4-1340600742-agent
time="2023-01-15T06:53:13.624Z" level=info msg="Workflow update successful" namespace=argo-workflows phase=Running resourceVersion=66963792 workflow=check-http-v46n4
time="2023-01-15T06:53:23.589Z" level=info msg="Processing workflow" namespace=argo-workflows workflow=check-http-v46n4
time="2023-01-15T06:53:23.589Z" level=info msg="Task-result reconciliation" namespace=argo-workflows numObjs=0 workflow=check-http-v46n4
time="2023-01-15T06:53:23.589Z" level=info msg=updateAgentPodStatus namespace=argo-workflows workflow=check-http-v46n4
time="2023-01-15T06:53:23.589Z" level=info msg=assessAgentPodStatus namespace=argo-workflows podName=check-http-v46n4-1340600742-agent
time="2023-01-15T06:53:23.590Z" level=info msg="TaskSet Reconciliation" namespace=argo-workflows workflow=check-http-v46n4
time="2023-01-15T06:53:23.590Z" level=info msg=reconcileAgentPod namespace=argo-workflows workflow=check-http-v46n4
time="2023-01-15T06:53:37.678Z" level=info msg="Processing workflow" namespace=argo-workflows workflow=check-http-v46n4
time="2023-01-15T06:53:37.678Z" level=info msg="Task-result reconciliation" namespace=argo-workflows numObjs=0 workflow=check-http-v46n4
time="2023-01-15T06:53:37.678Z" level=info msg=updateAgentPodStatus namespace=argo-workflows workflow=check-http-v46n4
time="2023-01-15T06:53:37.678Z" level=info msg=assessAgentPodStatus namespace=argo-workflows podName=check-http-v46n4-1340600742-agent
time="2023-01-15T06:53:37.679Z" level=info msg="TaskSet Reconciliation" namespace=argo-workflows workflow=check-http-v46n4
time="2023-01-15T06:53:37.679Z" level=info msg=reconcileAgentPod namespace=argo-workflows workflow=check-http-v46n4
time="2023-01-15T06:53:37.710Z" level=info msg="Workflow update successful" namespace=argo-workflows phase=Running resourceVersion=66964870 workflow=check-http-v46n4
time="2023-01-15T06:53:47.711Z" level=info msg="Processing workflow" namespace=argo-workflows workflow=check-http-v46n4
time="2023-01-15T06:53:47.711Z" level=info msg="Task-result reconciliation" namespace=argo-workflows numObjs=0 workflow=check-http-v46n4
time="2023-01-15T06:53:47.712Z" level=info msg=updateAgentPodStatus namespace=argo-workflows workflow=check-http-v46n4
time="2023-01-15T06:53:47.712Z" level=info msg=assessAgentPodStatus namespace=argo-workflows podName=check-http-v46n4-1340600742-agent
time="2023-01-15T06:53:47.712Z" level=info msg="node check-http-v46n4-1174646707 phase Running -> Succeeded" namespace=argo-workflows workflow=check-http-v46n4
time="2023-01-15T06:53:47.712Z" level=info msg="node check-http-v46n4-1174646707 finished: 2023-01-15 06:53:47.712473158 +0000 UTC" namespace=argo-workflows workflow=check-http-v46n4
time="2023-01-15T06:53:47.712Z" level=error msg="Mark error node" error="unexpected end of JSON input" namespace=argo-workflows nodeName=check-http-v46n4 workflow=check-http-v46n4
time="2023-01-15T06:53:47.712Z" level=info msg="node check-http-v46n4 phase Running -> Error" namespace=argo-workflows workflow=check-http-v46n4
time="2023-01-15T06:53:47.712Z" level=info msg="node check-http-v46n4 message: unexpected end of JSON input" namespace=argo-workflows workflow=check-http-v46n4
time="2023-01-15T06:53:47.712Z" level=info msg="node check-http-v46n4 finished: 2023-01-15 06:53:47.712543429 +0000 UTC" namespace=argo-workflows workflow=check-http-v46n4
time="2023-01-15T06:53:47.712Z" level=error msg="error in entry template execution" error="unexpected end of JSON input" namespace=argo-workflows workflow=check-http-v46n4
time="2023-01-15T06:53:47.712Z" level=info msg="Updated phase Running -> Error" namespace=argo-workflows workflow=check-http-v46n4
time="2023-01-15T06:53:47.712Z" level=info msg="Updated message -> error in entry template execution: unexpected end of JSON input" namespace=argo-workflows workflow=check-http-v46n4
time="2023-01-15T06:53:47.712Z" level=info msg="Marking workflow completed" namespace=argo-workflows workflow
check-http-v46n4
time="2023-01-15T06:53:47.712Z" level=info msg="Checking daemoned children of " namespace=argo-workflows workflow=check-http-v46n4
time="2023-01-15T06:53:47.718Z" level=info msg="cleaning up pod" action=deletePod key=argo-workflows/check-http-v46n4-1340600742-agent/deletePod
time="2023-01-15T06:53:47.730Z" level=info msg="Workflow update successful" namespace=argo-workflows phase=Error resourceVersion=66965319 workflow=check-http-v46n4
```
### Logs from in your workflow's wait container
```text
No wait container in the workflow
```
Contributor guide
Research direction
Start by reproducing the provided HTTP-template workflow with withParam on the workflow controller path that executes the entry template and reports the JSON error. Trace how the parameterized DAG completes and how the main task parses its result; done means the workflow succeeds without reporting unexpected end of JSON input.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100