The error occurs because the 3rd argument on the left-hand side is nonlinear, rather than being affine as required.
Have you proven your model is convex?
Note that your objective can be more simply written as
minimize(sum(sum(x)))
or
minimize(sum(x(:))