{"record":{"id":"c68d9f3d2bc60bbf","repo":"argoproj/argo-workflows","slug":"error-processing-data-step-d-w","errorCode":null,"errorMessage":"error processing data step %d: %w","messagePattern":"error processing data step (.+?): %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"workflow/data/data.go","lineNumber":51,"sourceCode":"\tdefault:\n\t\treturn nil, fmt.Errorf(\"no valid source is used for data template\")\n\t}\n\n\treturn data, nil\n}\n\nfunc processTransformation(data any, transformation *wfv1.Transformation) (any, error) {\n\tif transformation == nil {\n\t\treturn data, nil\n\t}\n\n\tvar err error\n\tfor i, step := range *transformation {\n\t\tif step.Expression != \"\" {\n\t\t\tdata, err = processExpression(step.Expression, data)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error processing data step %d: %w\", i, err)\n\t\t}\n\t}\n\n\treturn data, nil\n}\n\nfunc processExpression(expression string, data any) (any, error) {\n\tenv := map[string]any{\"data\": data}\n\tprogram, err := expr.Compile(expression, expr.Env(env))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn expr.Run(program, env)\n}\n","sourceCodeStart":33,"sourceCodeEnd":66,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/workflow/data/data.go#L33-L66","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Use the %d index in the message to find the failing transformation step and read its wrapped cause","Fix the expression to match the data shape produced by the previous step","Add a filter step before map/sort steps to handle empty results","Validate expressions with a small expr test or by running the data template in a scratch workflow"],"exampleFix":"// before\ntransformation:\n  - expression: \"sort(data, {# > #})\"        # wrong comparator syntax, step 1\n// after\ntransformation:\n  - expression: \"sort(data, {# < #})\"","handlingStrategy":"validation","validationCode":"// Validate each transformation step compiles before submitting\nfor i, step := range data.Transformation {\n    if _, err := expr.Compile(step.Expression, expr.Env(map[string]any{\"data\": sampleData})); err != nil {\n        return fmt.Errorf(\"step %d: %w\", i, err)\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Test transformation chains against realistic sample data in unit tests","Use the step index in the error to isolate the failing expression quickly","Guard against empty data with an early filter step","Stick to documented expr built-ins (filter, map, sort) and correct comparator syntax"],"tags":["data-template","expression-evaluation","transformation","argo-workflows"],"backgroundTag":"expression-evaluation-failed","analyzedSha":"35bff19146f5a6ada77468c431f2624bd577e373","analyzedAt":"2026-09-03T19:34:35.908Z","contentChangedAt":"2026-09-03T19:34:35.908Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}