# FunctionWrappers.jl -\> ERROR: LoadError: TypeError: in cfunction, expected Union{}, got a value of type Nothing

**URL:** <https://discourse.julialang.org/t/functionwrappers-jl-error-loaderror-typeerror-in-cfunction-expected-union-got-a-value-of-type-nothing/112447>\
**Category:** General Usage\
**Tags:** question\
**Created:** [April 3, 2024, 1:51am UTC](https://discourse.julialang.org/t/functionwrappers-jl-error-loaderror-typeerror-in-cfunction-expected-union-got-a-value-of-type-nothing/112447 "2024-04-03T01:51:42Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mcmuffin6o](https://avatars.discourse-cdn.com/v4/letter/m/9f8e36/32.png) [@mcmuffin6o](https://discourse.julialang.org/u/mcmuffin6o)\
**Post date:** [April 3, 2024, 1:51am UTC](https://discourse.julialang.org/t/functionwrappers-jl-error-loaderror-typeerror-in-cfunction-expected-union-got-a-value-of-type-nothing/112447/1 "2024-04-03T01:51:42Z")

</div>

The more I investigated this error, the more confused I got. It’s to the point where I don’t even think I could give an accurate reproduction procedure.

All I know and all I want to share with people that search for this error message is that restarting Julia fixed the issue. This is the same solution that worked for [a similar question](https://discourse.julialang.org/t/sundials-jl-loaderror-typeerror-in-cfunction-expected-union-got-int32/25059).

---

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [April 3, 2024, 4:02am UTC](https://discourse.julialang.org/t/functionwrappers-jl-error-loaderror-typeerror-in-cfunction-expected-union-got-a-value-of-type-nothing/112447/2 "2024-04-03T04:02:16Z")

</div>

Sorry, this is going to be very difficult if you cannot provide a reproducer.

---

<div class="post-metadata">

**Author:** ![mcmuffin6o](https://avatars.discourse-cdn.com/v4/letter/m/9f8e36/32.png) [@mcmuffin6o](https://discourse.julialang.org/u/mcmuffin6o)\
**Post date:** [April 9, 2024, 11:12pm UTC](https://discourse.julialang.org/t/functionwrappers-jl-error-loaderror-typeerror-in-cfunction-expected-union-got-a-value-of-type-nothing/112447/3 "2024-04-09T23:12:49Z")

</div>

I don’t need help. I only made this post to suggest to people facing similar issues to try restarting Julia.

If someone figures out what causes this (I suspect some Revise edge case, but I really shouldn’t speculate like that), then they should feel free to comment, but no need.

---

<div class="post-metadata">

**Author:** ![mcmuffin6o](https://avatars.discourse-cdn.com/v4/letter/m/9f8e36/32.png) [@mcmuffin6o](https://discourse.julialang.org/u/mcmuffin6o)\
**Post date:** [July 15, 2024, 8:54pm UTC](https://discourse.julialang.org/t/functionwrappers-jl-error-loaderror-typeerror-in-cfunction-expected-union-got-a-value-of-type-nothing/112447/4 "2024-07-15T20:54:25Z")

</div>

LOL! I had the issue again, so I copy pasted the error message into Google search and lo and behold, it brought me back to this post I had completely forgotten about.

The best part is that the solution was indeed to restart Julia! Sorry to necro the thread, but this was too funny not to share.

---

<div class="post-metadata">

**Author:** ![Wu-Chenyang](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wu-chenyang/32/21694_2.png) [@Wu-Chenyang](https://discourse.julialang.org/u/Wu-Chenyang)\
**Post date:** [January 7, 2025, 11:49am UTC](https://discourse.julialang.org/t/functionwrappers-jl-error-loaderror-typeerror-in-cfunction-expected-union-got-a-value-of-type-nothing/112447/5 "2025-01-07T11:49:04Z")

</div>

Thanks for sharing. I encountered this problem today and fixed it by restarting julia. The error appears when I am using DifferentialEquations.jl. So, it’s probably related to this issue, [Functions do not properly redefine with FunctionWrappers in v1.10? · Issue #52635 · JuliaLang/julia](https://github.com/JuliaLang/julia/issues/52635)
