$setWindowFields raises an error if the partitionBy expression ever evaluates to an array. (We added this restriction to allow $sort to handle most of the partitioning.)
But during parsing, if the partitionBy expression optimizes to a constant, we remove it. (Partitioning by a constant is equivalent to not doing any partitioning.) We do this even if it's a constant array, which hides the error. This is misleading: we say partitionBy can't be an array, but then examples like 'partitionBy: [1, 2, 3]' don't raise an error.