argoproj/argo-workflows · error

error processing data step %d: %w

Error message

error processing data step %d: %w

What it means

A specific transformation step (by index) failed while processing a Data template. Each entry in spec.data.transformation runs through processExpression when its expression is non-empty; if any step errors, the error is wrapped with the step index so you can locate the offending expression.

Source

Thrown at workflow/data/data.go:51

	default:
		return nil, fmt.Errorf("no valid source is used for data template")
	}

	return data, nil
}

func processTransformation(data any, transformation *wfv1.Transformation) (any, error) {
	if transformation == nil {
		return data, nil
	}

	var err error
	for i, step := range *transformation {
		if step.Expression != "" {
			data, err = processExpression(step.Expression, data)
		}
		if err != nil {
			return nil, fmt.Errorf("error processing data step %d: %w", i, err)
		}
	}

	return data, nil
}

func processExpression(expression string, data any) (any, error) {
	env := map[string]any{"data": data}
	program, err := expr.Compile(expression, expr.Env(env))
	if err != nil {
		return nil, err
	}
	return expr.Run(program, env)
}

View on GitHub (pinned to 35bff19146)

Solutions

  1. Use the %d index in the message to find the failing transformation step and read its wrapped cause
  2. Fix the expression to match the data shape produced by the previous step
  3. Add a filter step before map/sort steps to handle empty results
  4. Validate expressions with a small expr test or by running the data template in a scratch workflow

Example fix

// before
transformation:
  - expression: "sort(data, {# > #})"        # wrong comparator syntax, step 1
// after
transformation:
  - expression: "sort(data, {# < #})"
Defensive patterns

Strategy: validation

Validate before calling

// Validate each transformation step compiles before submitting
for i, step := range data.Transformation {
    if _, err := expr.Compile(step.Expression, expr.Env(map[string]any{"data": sampleData})); err != nil {
        return fmt.Errorf("step %d: %w", i, err)
    }
}

Prevention

When it happens

Trigger: The i-th transformation step's expression fails to compile or evaluate against the current data value — type mismatch (e.g. mapping a string), unknown identifier, or expr syntax error.

Common situations: Chained steps where an earlier step changed the data shape so a later expression no longer fits, empty data lists fed into map/filter, or expr built-ins used incorrectly.

Related errors


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