Hi - no I don't know what is going on with your expression but I can tell you that I am getting a similar error with an Arcade expression that works fine in MapViewer Beta 5 (enterprise 10.8.1) and in the classic map viewer Online, or the Enterprise map viewer. This expression:
var FutureRd = $feature["future_rd"];
var NumberLanes = $feature["num_lanes"];
var FutureLanes = $feature["fut_lanes"];
var typing = When(FutureRd == 'NO' && NumberLanes == FutureLanes,'Complete, No Widening',
FutureRd == 'NO' && NumberLanes != FutureLanes,
'Complete, Widening Required', 'Future / Unbuilt');
return typing;
fails with a return 'Warning, return type must be a number'. So even if I cast the NumberLanes and FutureLanes vars as text, still doesn't work in New MapViewer. If I build the expression in Classic, and then open the map in New, the New Map Viewer does honor the expression. For now that's my workaround