Invalid X or Z in state expression value for constraint

The error message should have included a line number that points to the constraint in question. Usually the problem is a confusion over which scope a variable in the ‘with’ constraint is referring to.

Also, there is no need to declare int i in your task, and you should use int to declare identifier instead of integer if you really do not ever want to see an X.