Troubleshooting JSONata transform error: "Cannot convert undefined or null to object"
applies to turbine cloud 26 4 1 (jsonata 2 2 1 ) overview a playbook or component may fail in a transform data action with this jsonata error cannot convert undefined or null to object this usually means a transform expression is referencing a field or property that is not present in the input data for that run turbine cloud 26 4 1 uses jsonata 2 2 1 , which evaluates these cases more strictly than earlier jsonata versions in earlier releases, an invalid property path could resolve to empty or undefined output without failing the transform block with jsonata 2 2 1 , expressions that pass undefined or null into object functions (such as $sift() ) are more likely to fail the block and stop the playbook run this is not a universal change to transform output structure in most reported cases, the expression itself references an invalid path that previously may not have caused the block to fail symptoms you may see a playbook or component run fails in a transform action (commonly seen on 26 4 1 with jsonata 2 2 1 ) failure occurs in a transform data / jsonata action error message cannot convert undefined or null to object the error may also include the transform block name (for example, data ) a position number in the expression what to check confirm your tenant is on 26 4 1 (jsonata 2 2 1 ) open the failed playbook run and identify the failing action the transform block name the exact error message review the transform expression against the actual input payload from the failed run look for references to properties or paths that do not exist in the input json if the expression assumes a nested object exists, but the payload contains null or a missing field, the transform may fail under jsonata 2 2 1 if your error looks different the same error message can have different root causes not every cannot convert undefined or null to object failure has the same fix if your failure does not match a known pattern below, contact swimlane support and provide tenant url / region turbine version ( 26 4 1 ) playbook or component name failing action and transform block name run id and job id screenshot or export of the failing transform expression time the failure started support will review the expression against the actual run input and advise on the correct fix known example email ingestion (process graph api email) we have also seen this error in email ingestion workflows using the component below include this section only if your failure matches this pattern component process graph api email failing location item value action parse attachment fields transform block data cause the transform expression may reference an invalid property path such as $sift(loops foreach attachment value attacment info, function($v, $k) { $k != "contentbytes"}) the attachment data is structured as { "info" { }, "data" \[ ] } because attacment is not a valid property, the expression fails under jsonata 2 2 1 resolution update the expression in block data to $sift(loops foreach attachment value info, function($v, $k) { $k != "contentbytes"}) steps open the process graph api email component go to parse attachment fields edit transform block data update the expression as shown above save the component re run the workflow and confirm the playbook completes successfully short summary some transform actions may fail with "cannot convert undefined or null to object" when jsonata 2 2 1 evaluates an invalid property path more strictly than earlier versions review the failing expression against the run input payload one known example affects email ingestion via process graph api email β parse attachment fields β block data contact support if your case does not match or you need help validating the fix need more help? open a support ticket with your run details and reference this article our team can help confirm whether your case matches a known pattern or needs further investigation