argoproj/argo-workflows · error

unable to process data transformation: %w

Error message

unable to process data transformation: %w

What it means

ProcessData failed at the transformation stage: after sourcing data successfully, applying one of the spec.data.transformation expressions (processTransformation) returned an error, wrapped with this message. Transformation steps use expr to filter, map, or reduce the sourced data.

Source

Thrown at workflow/data/data.go:19

package data

import (
	"context"
	"fmt"

	"github.com/expr-lang/expr"

	wfv1 "github.com/argoproj/argo-workflows/v4/pkg/apis/workflow/v1alpha1"
)

func ProcessData(ctx context.Context, data *wfv1.Data, processor wfv1.DataSourceProcessor) (any, error) {
	sourcedData, err := processSource(ctx, data.Source, processor)
	if err != nil {
		return nil, fmt.Errorf("unable to process data source: %w", err)
	}
	transformedData, err := processTransformation(sourcedData, &data.Transformation)
	if err != nil {
		return nil, fmt.Errorf("unable to process data transformation: %w", err)
	}
	return transformedData, nil
}

func processSource(ctx context.Context, source wfv1.DataSource, processor wfv1.DataSourceProcessor) (any, error) {
	var data any
	var err error
	switch {
	case source.ArtifactPaths != nil:
		data, err = processor.ProcessArtifactPaths(ctx, source.ArtifactPaths)
		if err != nil {
			return nil, fmt.Errorf("unable to source artifact paths: %w", err)
		}
	default:
		return nil, fmt.Errorf("no valid source is used for data template")
	}

	return data, nil

View on GitHub (pinned to 35bff19146)

Solutions

  1. Check the wrapped cause for which transformation step index failed and why
  2. Validate the expression syntax against expr-lang and ensure it matches the data shape produced by artifactPaths (a list of path strings)
  3. Add defensive expressions (e.g. filter before map) so empty/odd data doesn't break later steps
  4. Test the data template standalone with examples from docs/workflow-templates before deploying

Example fix

// before
transformation:
  - expression: "map(data, {# .path})"   // syntax error
// after
transformation:
  - expression: "map(data, {#.path})"
Defensive patterns

Strategy: validation

Validate before calling

import "github.com/expr-lang/expr"
for i, step := range data.Transformation {
    if _, err := expr.Compile(step.Expression, expr.Env(map[string]any{"data": sourcedData})); err != nil {
        return fmt.Errorf("transformation step %d invalid: %w", i, err)
    }
}

Prevention

When it happens

Trigger: A transformation step expression fails to parse or evaluate against the sourced data — e.g. using filter/map on data of an unexpected shape, or syntax errors in the expr expression.

Common situations: Expressions written for lists applied to non-list data, wrong field names on map elements, expr version syntax differences, or empty results mishandled.

Related errors


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