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, nilView on GitHub (pinned to 35bff19146)
Solutions
- Check the wrapped cause for which transformation step index failed and why
- Validate the expression syntax against expr-lang and ensure it matches the data shape produced by artifactPaths (a list of path strings)
- Add defensive expressions (e.g. filter before map) so empty/odd data doesn't break later steps
- 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
- Compile every transformation expression against the expected data shape in tests
- Remember artifactPaths yields a list of path strings — write expressions accordingly
- Chain steps carefully: each step sees the output of the previous one
- Use docs examples for filter/map/sort syntax
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
- error processing data step %d: %w
- failed to check CronWorkflow '%s' stopping condition: %w
- failed to evaluate stop expression: %w
- unable to process data source: %w
- unable to source artifact paths: %w
AI-assisted analysis of argoproj/argo-workflows@35bff19146 (2026-09-03).
Data as JSON: /api/errors/064612a634918d48.
Report an issue: GitHub.