# Address the error "BoundsError: attempt to access 0-element Vector{Float64} at index \[1\]"

**URL:** <https://discourse.julialang.org/t/address-the-error-boundserror-attempt-to-access-0-element-vector-float64-at-index-1/93683>\
**Category:** General Usage\
**Tags:** question, package\
**Created:** [January 28, 2023, 10:55am UTC](https://discourse.julialang.org/t/address-the-error-boundserror-attempt-to-access-0-element-vector-float64-at-index-1/93683 "2023-01-28T10:55:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kanishk](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kanishk/32/46224_2.png) [@Kanishk](https://discourse.julialang.org/u/Kanishk)\
**Post date:** [January 28, 2023, 10:55am UTC](https://discourse.julialang.org/t/address-the-error-boundserror-attempt-to-access-0-element-vector-float64-at-index-1/93683/1 "2023-01-28T10:55:25Z")

</div>

Hello

I am using the “IntervalArithmetic.jl” package in Pluto.jl notebook. While executing the code code I am getting the following error

```julia
BoundsError: attempt to access 0-element Vector{Float64} at index [1]
getindex(::Vector{Float64}, ::Int64)@array.jl:924

```

The piece of code from where the error is coming -

```julia
XYnew = [(0..5), (0..5), (0..5), (0..5)]
mid_X = mid.(XYnew)
		arg = mid_X[1]

```

Could you please let me know the possible reason for the error? Not only this time but I face this type of error many times. So, the solution could be really helpful for me.  
Thank you

---

<div class="post-metadata">

**Author:** ![p-gw](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/p-gw/32/210518_2.png) [@p-gw](https://discourse.julialang.org/u/p-gw)\
**Post date:** [January 28, 2023, 11:19am UTC](https://discourse.julialang.org/t/address-the-error-boundserror-attempt-to-access-0-element-vector-float64-at-index-1/93683/2 "2023-01-28T11:19:48Z")

</div>

From your code the error is not reproducible for me.

```julia
julia> using IntervalArithmetic

julia> XYnew = [(0..5), (0..5), (0..5), (0..5)]
4-element Vector{Interval{Float64}}:
 [0, 5]
 [0, 5]
 [0, 5]
 [0, 5]

julia> mid_X = mid.(XYnew)
4-element Vector{Float64}:
 2.5
 2.5
 2.5
 2.5

julia> mid_X[1]
2.5

```

You mentioned that you are using Pluto.jl, so my guess is that there is probably another cell in your notebook modifying any of the variables resulting in the error.

---

<div class="post-metadata">

**Author:** ![Kanishk](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kanishk/32/46224_2.png) [@Kanishk](https://discourse.julialang.org/u/Kanishk)\
**Post date:** [January 28, 2023, 12:54pm UTC](https://discourse.julialang.org/t/address-the-error-boundserror-attempt-to-access-0-element-vector-float64-at-index-1/93683/3 "2023-01-28T12:54:04Z")

</div>

Dear @p-gw, there is no other cell but one thing I would like to mention is that I am using this code inside a “for” loop.

```julia
for i in 1:n
		mid_X = map(mid, XYnew)
		#mid_X = mid.(XYnew)
		arg1 = mid_X[1]
		arg2= mid_X[3]
		M = inv(jacobian(arg1, arg2))

```

---

<div class="post-metadata">

**Author:** ![GunnarFarneback](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunnarfarneback/32/1827_2.png) [@GunnarFarneback](https://discourse.julialang.org/u/GunnarFarneback)\
**Post date:** [January 28, 2023, 1:28pm UTC](https://discourse.julialang.org/t/address-the-error-boundserror-attempt-to-access-0-element-vector-float64-at-index-1/93683/4 "2023-01-28T13:28:53Z")

</div>

You need to show us enough code so we can reproduce the error. What the message is saying is that you try to index into an empty vector, so it would appear that `XYnew` becomes empty at some point in your loop.
