# Error while defining binary variable in JuMP

**URL:** <https://discourse.julialang.org/t/error-while-defining-binary-variable-in-jump/115249>\
**Category:** Optimization (Mathematical)\
**Tags:** jump\
**Created:** [June 5, 2024, 6:00pm UTC](https://discourse.julialang.org/t/error-while-defining-binary-variable-in-jump/115249 "2024-06-05T18:00:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![vineetjnair9](https://avatars.discourse-cdn.com/v4/letter/v/96bed5/32.png) [@vineetjnair9](https://discourse.julialang.org/u/vineetjnair9)\
**Post date:** [June 5, 2024, 6:00pm UTC](https://discourse.julialang.org/t/error-while-defining-binary-variable-in-jump/115249/1 "2024-06-05T18:00:14Z")

</div>

Hi, I’m trying to initialize a vector of binary variables as follows:

model = Model(Gurobi.Optimizer)  
@variable(model, z[1:12], Bin)

But I get this error:

Exception has occurred: MethodError

MethodError: no method matching promote\_shape(::Tuple{Vector{Int64}}, ::Tuple{Vector{Int64}})

How can I resolve this?

---

<div class="post-metadata">

**Author:** ![gdalle](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gdalle/32/224680_2.png) [@gdalle](https://discourse.julialang.org/u/gdalle)\
**Post date:** [June 5, 2024, 7:08pm UTC](https://discourse.julialang.org/t/error-while-defining-binary-variable-in-jump/115249/2 "2024-06-05T19:08:53Z")

</div>

Hi! Can you share the complete code and the complete error stacktrace?

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [June 5, 2024, 8:02pm UTC](https://discourse.julialang.org/t/error-while-defining-binary-variable-in-jump/115249/3 "2024-06-05T20:02:44Z")

</div>

Hi @vineetjnair9, what version of JuMP and Julia are you using? Your code is correct; it shouldn’t trigger this error, so something else must be going on.
