# Nested task error on Julia-1.12-rc1

**URL:** <https://discourse.julialang.org/t/nested-task-error-on-julia-1-12-rc1/131256>\
**Category:** General Usage\
**Tags:** question, multithreading\
**Created:** [July 31, 2025, 4:36pm UTC](https://discourse.julialang.org/t/nested-task-error-on-julia-1-12-rc1/131256 "2025-07-31T16:36:21Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [July 31, 2025, 4:36pm UTC](https://discourse.julialang.org/t/nested-task-error-on-julia-1-12-rc1/131256/1 "2025-07-31T16:36:21Z")

</div>

Any idea what is going on here? [Enable multithreading · ufechner7/FLORIDyn.jl@f2175f3 · GitHub](https://github.com/ufechner7/FLORIDyn.jl/actions/runs/16654482549/job/47135800461)

```julia-auto
      Testing Running tests...
runFLORIDyn - online: Error During Test at /home/runner/work/FLORIDyn.jl/FLORIDyn.jl/test/test_floridyn_cl.jl:153
  Got exception outside of a @test
  TaskFailedException
  
      nested task error: BoundsError: attempt to access 1-element Vector{WindFarm} at index [2]
      Stacktrace:
       [1] throw_boundserror(A::Vector{WindFarm}, I::Tuple{Int64})
         @ Base ./essentials.jl:15
       [2] getindex
         @ ./essentials.jl:919 [inlined]
       [3] macro expansion
         @ ~/work/FLORIDyn.jl/FLORIDyn.jl/src/visualisation/calc_flowfield.jl:99 [inlined]
       [4] (::FLORIDyn.var"#getMeasurements##2#getMeasurements##3"{FLORIDyn.var"#getMeasurements##4#getMeasurements##5"{Matrix{Float64}, Matrix{Float64}, Float64, Settings, Floris, Wind, Vector{WindFarm}, Array{Float64, 3}, Tuple{Int64, Int64}, UnitRange{Int64}}})(tid::Int64; onethread::Bool)
         @ FLORIDyn ./threadingconstructs.jl:276
       [5] #getMeasurements##2
         @ ./threadingconstructs.jl:243 [inlined]
       [6] 

```

Have there been changes with respect to threading in Julia 1.12?

My tests pass on Julia 1.10 and 1.11.

---

<div class="post-metadata">

**Author:** ![mbauman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbauman/32/31082_2.png) [@mbauman](https://discourse.julialang.org/u/mbauman)\
**Post date:** [July 31, 2025, 4:40pm UTC](https://discourse.julialang.org/t/nested-task-error-on-julia-1-12-rc1/131256/2 "2025-07-31T16:40:46Z")

</div>

> <https://github.com/ufechner7/FLORIDyn.jl/blob/f2175f31f6c2c78d53692b98ff9b6a9924df7ac8/src/visualisation/calc_flowfield.jl#L97-L99>

That’s your problem. [PSA: Thread-local state is no longer recommended; Common misconceptions about threadid() and nthreads()](https://discourse.julialang.org/t/psa-thread-local-state-is-no-longer-recommended-common-misconceptions-about-threadid-and-nthreads/101274)

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [July 31, 2025, 4:42pm UTC](https://discourse.julialang.org/t/nested-task-error-on-julia-1-12-rc1/131256/3 "2025-07-31T16:42:14Z")

</div>

What is the suggested work-around?

---

<div class="post-metadata">

**Author:** ![mbauman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbauman/32/31082_2.png) [@mbauman](https://discourse.julialang.org/u/mbauman)\
**Post date:** [July 31, 2025, 4:46pm UTC](https://discourse.julialang.org/t/nested-task-error-on-julia-1-12-rc1/131256/4 "2025-07-31T16:46:52Z")

</div>

There are multiple suggested in the linked blog post:

> **[PSA: Thread-local state is no longer recommended](https://julialang.org/blog/2023/07/PSA-dont-use-threadid/#fixing_buggy_code_which_uses_this_pattern)**
>
> PSA: Thread-local state is no longer recommended; Common misconceptions about threadid() and nthreads()

---

<div class="post-metadata">

**Author:** ![Mason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mason/32/2423_2.png) [@Mason](https://discourse.julialang.org/u/Mason)\
**Post date:** [July 31, 2025, 4:49pm UTC](https://discourse.julialang.org/t/nested-task-error-on-julia-1-12-rc1/131256/5 "2025-07-31T16:49:56Z")

</div>

Ive been meaning to update that blog post. I’d say my new main recommendation would be to switch to OhMyThreads.jl.

We have some pretty detailed docs on specifically this problem here: [Thread-Safe Storage · OhMyThreads.jl](https://juliafolds2.github.io/OhMyThreads.jl/stable/literate/tls/tls/)
