I do not get your error, it works for me. Here is what I get with your code on Julia v1.4.1:

```
julia> using JuMP
julia> model = Model();
julia> T = 3
3
julia> @variable(model, x[1:T]>=0, Int)
3-element Array{VariableRef,1}:
x[1]
x[2]
x[3]
julia> @constraint(model, xx[t=1:T], complements((x[t+1]+x[t+2]), x[t]))
ERROR: BoundsError: attempt to access 3-element Array{VariableRef,1} at index [4]
Stacktrace:
[1] getindex(::Array{VariableRef,1}, ::Int64) at ./array.jl:788
[2] macro expansion at /home/blegat/.julia/packages/MutableArithmetics/ZGFsK/src/rewrite.jl:227 [inlined]
[3] macro expansion at /home/blegat/.julia/packages/JuMP/MnJQc/src/macros.jl:381 [inlined]
[4] (::var"#9#10")(::Int64) at /home/blegat/.julia/packages/JuMP/MnJQc/src/Containers/macro.jl:183
[5] #26 at /home/blegat/.julia/packages/JuMP/MnJQc/src/Containers/container.jl:70 [inlined]
[6] iterate at ./generator.jl:47 [inlined]
[7] collect_to!(::Array{ConstraintRef{Model,MathOptInterface.ConstraintIndex{MathOptInterface.VectorAffineFunction{Float64},MathOptInterface.Complements},VectorShape},1}, ::Base.Generator{JuMP.Containers.VectorizedProductIterator{Tuple{Base.OneTo{Int64}}},JuMP.Containers.var"#26#27"{var"#9#10"}}, ::Int64, ::Tuple{Tuple{Int64,Int64}}) at ./array.jl:711
[8] collect_to_with_first!(::Array{ConstraintRef{Model,MathOptInterface.ConstraintIndex{MathOptInterface.VectorAffineFunction{Float64},MathOptInterface.Complements},VectorShape},1}, ::ConstraintRef{Model,MathOptInterface.ConstraintIndex{MathOptInterface.VectorAffineFunction{Float64},MathOptInterface.Complements},VectorShape}, ::Base.Generator{JuMP.Containers.VectorizedProductIterator{Tuple{Base.OneTo{Int64}}},JuMP.Containers.var"#26#27"{var"#9#10"}}, ::Tuple{Tuple{Int64,Int64}}) at ./array.jl:689
[9] collect(::Base.Generator{JuMP.Containers.VectorizedProductIterator{Tuple{Base.OneTo{Int64}}},JuMP.Containers.var"#26#27"{var"#9#10"}}) at ./array.jl:670
[10] map(::Function, ::JuMP.Containers.VectorizedProductIterator{Tuple{Base.OneTo{Int64}}}) at ./abstractarray.jl:2098
[11] container at /home/blegat/.julia/packages/JuMP/MnJQc/src/Containers/container.jl:70 [inlined]
[12] container(::Function, ::JuMP.Containers.VectorizedProductIterator{Tuple{Base.OneTo{Int64}}}) at /home/blegat/.julia/packages/JuMP/MnJQc/src/Containers/container.jl:65
[13] top-level scope at /home/blegat/.julia/packages/JuMP/MnJQc/src/macros.jl:79
julia> @constraint(model, xx[t=1:T], complements((x[((t) % T) + 1] + x[((t+1) % T) + 1]), x[t]))
3-element Array{ConstraintRef{Model,MathOptInterface.ConstraintIndex{MathOptInterface.VectorAffineFunction{Float64},MathOptInterface.Complements},VectorShape},1}:
xx[1] : [x[2] + x[3], x[1]] ∈ MathOptInterface.Complements(1)
xx[2] : [x[3] + x[1], x[2]] ∈ MathOptInterface.Complements(1)
xx[3] : [x[1] + x[2], x[3]] ∈ MathOptInterface.Complements(1)
(@v1.4) pkg> st JuMP
Status `~/.julia/environments/v1.4/Project.toml`
[4076af6c] JuMP v0.21.2
```

PS: See Please read: make it easier to help you for how to format the code in your question.