Error in Using "@threads"

This is the whole error message:

  0.284914 seconds (549.45 k allocations: 33.806 MiB, 53.39% compilation time)

ERROR: LoadError: TaskFailedException
Stacktrace:
 [1] wait
   @ .\task.jl:322 [inlined]
 [2] threading_run(func::Function)
   @ Base.Threads .\threadingconstructs.jl:34
 [3] macro expansion
   @ .\threadingconstructs.jl:93 [inlined]
 [4] DefineYnImproved()
   @ Main c:\Work\From Javad\Whole Package\EMTJulia\DefineYnImproved.jl:6
 [5] top-level scope
   @ .\timing.jl:210

    nested task error: BoundsError: attempt to access 10-element Vector{Int64} at index [10]
    Stacktrace:
     [1] getindex
       @ .\array.jl:801 [inlined]
     [2] getindex(A::SparseMatrixCSC{Float64, Int64}, i0::Int64, i1::Int64)
       @ SparseArrays C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\SparseArrays\src\sparsematrix.jl:2134
     [3] macro expansion
       @ c:\Work\From Javad\Whole Package\EMTJulia\DefineYnImproved.jl:12 [inlined]
     [4] (::var"#41#threadsfor_fun#6"{UnitRange{Int64}})(onethread::Bool)
       @ Main .\threadingconstructs.jl:81
     [5] (::var"#41#threadsfor_fun#6"{UnitRange{Int64}})()
       @ Main .\threadingconstructs.jl:48
in expression starting at c:\Work\From Javad\Whole Package\EMTJulia\makeNetlistTest.jl:120