Generally that exception is trying to tell you that your destination field is a concrete value, and you are trying to make it an object. The exception can be misleading because
- "on object ''" prints the value of the field, not the name of the field
- "is not either a map or a string" is just wrong, because the exception gets thrown when the field is a string!
So ... [metadata] exists, but is a value, not an object. Could it be a boolean?