Error using sparse: Index into matrix must be positive

I’m using sedumi solver to solve a second order cone problem.

When I add some particular constraints into the model, there are some error messages as follows.

I’m not sure what’s wrong in my model and this error is very strange.

I’m solving a multi-stage model. For the first two periods’ constraints, they are fine. But if I add the third period’s constraint, here is the error. These constraints have exactly the same structure. The only difference is the value of the parameter.

So what are the possibilities of having this error?

Error using sparse
Index into matrix must be positive.

Error in cvxprob/eliminate (line 232)
PP{k} = sparse(1:numel(temp),temp,1,numel(temp),n1);

Error in cvxprob/solve (line 17)
[ At, cones, sgn, Q, P, dualized ] = eliminate( prob, true, shim.dualize );

Error in cvx_end (line 79)
solve( prob );

This is a bug, so it would qualify as something to be sent to the bug reporting system instead of posting it here. But you’ll also need to provide far more detail: what version of CVX and/or MATLAB are you using? You’ll also need to be able to provide a reproducible example.