UPDATE MERGE inside FOREACH inside BATCH throws parsing error

In a batch statement I have:
FOREACH ($element in :updateNodes) {
UPDATE System
Merge $element.data
WHERE @rid=$element.nodeRid;
}
It errors out with an error message of:
(node:17487) UnhandledPromiseRejectionWarning: OrientDB.RequestError: Error parsing query:
Encountered " "UPDATE “” at line 24, column 9.
Was expecting one of:



“;” …




The element data is in the form of:
data: { field_name: "some text" }

It works properly when done like this:
FOREACH ($element in :updateNodes) {
UPDATE System
Merge { field_name: “some text” }
WHERE @rid=$element.nodeRid;
}
But that makes each record have the same value which is not what I am looking for.
The first one gives the error.

Does anyone have any ideas of what this could be?