# Error "KeyError: key false not found"

**URL:** <https://discourse.julialang.org/t/error-keyerror-key-false-not-found/89675>\
**Category:** New to Julia\
**Created:** [November 2, 2022, 8:44pm UTC](https://discourse.julialang.org/t/error-keyerror-key-false-not-found/89675 "2022-11-02T20:44:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![salmamelsherif](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/salmamelsherif/32/44067_2.png) [@salmamelsherif](https://discourse.julialang.org/u/salmamelsherif)\
**Post date:** [November 2, 2022, 8:44pm UTC](https://discourse.julialang.org/t/error-keyerror-key-false-not-found/89675/1 "2022-11-02T20:44:10Z")

</div>

I am trying to test my code where i use MCPModel and I keep getting this error:

Test threw exception  
Expression: all(isapprox.(z[I₊] - u[I₊], 0; atol = tol))  
KeyError: key false not found

Code:  
function ensure\_correct(z, M, N, q, l, u, w; tol=1e-4)  
r = M_z + N_w + q

```
I₋ = r .< -tol
I₊ = r .> tol
I₀ = isapprox.(r, 0; atol=tol)

@test all(isapprox.(z[I₊] - u[I₊], 0; atol=tol))
@test all(isapprox.(z[I₋] - l[I₋], 0; atol=tol))
@test all(l.-tol .≤ z .≤ u.+tol)

```

end

@testset “lmcp” begin  
rng = MersenneTwister(420)  
for i = 1:10  
M = randn(rng, 5,10)  
M = M’\*M  
N = randn(rng, 10, 3)  
w = randn(rng, 3)  
q = randn(rng, 10)  
l = randn(rng, 10)  
u = randn(rng, 10)  
inconsistent = u.\<l  
u[inconsistent] = l[inconsistent]  
z = solve\_lmcp(M, N, q, l, u, w)  
ensure\_correct(z, M, N, q, l, u, w)  
end  
end

> Blockquote

---

<div class="post-metadata">

**Author:** ![SteffenPL](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/steffenpl/32/206270_2.png) [@SteffenPL](https://discourse.julialang.org/u/SteffenPL)\
**Post date:** [November 2, 2022, 11:20pm UTC](https://discourse.julialang.org/t/error-keyerror-key-false-not-found/89675/2 "2022-11-02T23:20:37Z")

</div>

It seems that `z` or `I₊` don’t have the types you would expect.

Can you maybe add `@show type(I₊) type(z)`. Maybe `z` is a Dictionary and then you need to access it in a different way.
