argoproj/argo-workflows · error

agent cannot execute: unknown task type: %v

Error message

agent cannot execute: unknown task type: %v

What it means

The AgentExecutor (which runs HTTP and plugin templates on behalf of the controller via WorkflowTaskSet) only supports templates whose type is http or plugin. If the resolved template has any other type (script, container, pod, etc.), processTask falls through to the default branch and returns this error, failing the node with the message in NodeResult.

Source

Thrown at workflow/executor/agent.go:241

			}

			// Patch was successful, clear nodeResults for next iteration
			nodeResults = map[string]wfv1.NodeResult{}

			logger.Info(ctx, "Patched TaskSet")
		}
	}
}

func (ae *AgentExecutor) processTask(ctx context.Context, tmpl wfv1.Template) (*wfv1.NodeResult, time.Duration, error) {
	var executeTemplate templateExecutor
	switch {
	case tmpl.HTTP != nil:
		executeTemplate = ae.executeHTTPTemplate
	case tmpl.Plugin != nil:
		executeTemplate = ae.executePluginTemplate
	default:
		return nil, 0, fmt.Errorf("agent cannot execute: unknown task type: %v", tmpl.GetType())
	}
	result := &wfv1.NodeResult{}
	requeue, err := executeTemplate(ctx, tmpl, result)
	if err != nil {
		result.Phase = wfv1.NodeFailed
		result.Message = err.Error()
	}
	return result, requeue, nil
}

func (ae *AgentExecutor) executeHTTPTemplate(ctx context.Context, tmpl wfv1.Template, result *wfv1.NodeResult) (time.Duration, error) {
	if tmpl.HTTP == nil {
		return 0, nil
	}
	// Read response.Body after cancel(), sometimes it return a context canceled error
	// For more detail  https://groups.google.com/g/golang-nuts/c/2FKwG6oEvos
	var cancel context.CancelFunc
	if tmpl.HTTP.TimeoutSeconds != nil {

View on GitHub (pinned to 35bff19146)

Solutions

  1. Check the template spec in the WorkflowTaskSet/Workflow and ensure it defines an http: or plugin: field
  2. Upgrade argoexec and workflow-controller to matching versions so the agent supports the template type
  3. Run the template with a regular executor path (container/script) instead of the agent if it is not an HTTP or plugin template
  4. Validate the workflow with `argo lint` before submitting to catch templates without a recognized type

Example fix

# before (template routed to agent, no typed field)
template:
  name: my-task
  metadata: {}
# after
template:
  name: my-task
  http:
    method: GET
    url: https://example.com
Defensive patterns

Strategy: validation

Validate before calling

// Before submitting, lint the workflow so every template has a supported typed field:
// argo lint workflow.yaml
// Programmatic check on a resolved template:
func isAgentTemplate(t *wfv1.Template) bool {
	return t.HTTP != nil || t.Plugin != nil
}
if !isAgentTemplate(tmpl) {
	// route to regular executor instead of agent
}

Type guard

func hasSupportedAgentType(tmpl *wfv1.Template) bool {
	return tmpl != nil && (tmpl.HTTP != nil || tmpl.Plugin != nil)
}

Prevention

When it happens

Trigger: A WorkflowTaskSet contains a Task whose template is neither tmpl.HTTP nor tmpl.Plugin — e.g. a container/script/resource template was routed to the agent, or a template spec with no recognized typed field.

Common situations: Controller/executor version skew where a new template type is sent to an older executor; misconfigured workflow routing template kinds to the agent; a template that failed validation so no typed field (http/plugin) was populated; typos or empty template specs.

Related errors


AI-assisted analysis of argoproj/argo-workflows@35bff19146 (2026-09-03). Data as JSON: /api/errors/7991710e9409497b. Report an issue: GitHub.