Maybe parts of the expression are too complex for text format (like lists, nested fields, or linked data types)? Try using :formatted as text where needed.
:formatted as text