# Project precompilation fails with \`ArgumentError: Invalid header in cache file ...\`

**URL:** <https://discourse.julialang.org/t/project-precompilation-fails-with-argumenterror-invalid-header-in-cache-file/67256>\
**Category:** General Usage\
**Created:** [August 29, 2021, 1:06am UTC](https://discourse.julialang.org/t/project-precompilation-fails-with-argumenterror-invalid-header-in-cache-file/67256 "2021-08-29T01:06:01Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Samuel\_Ainsworth](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/samuel_ainsworth/32/15644_2.png) [@Samuel\_Ainsworth](https://discourse.julialang.org/u/Samuel_Ainsworth)\
**Post date:** [August 29, 2021, 1:06am UTC](https://discourse.julialang.org/t/project-precompilation-fails-with-argumenterror-invalid-header-in-cache-file/67256/1 "2021-08-29T01:06:01Z")

</div>

I have a julia project that refuses to `] precompile`. I get the following error:

```julia
Precompiling project...
  ✗ odecontrol
  296 dependencies successfully precompiled in 290 seconds (8 already precompiled)

ERROR: The following 1 direct dependency failed to precompile:

odecontrol [add7d8ba-c849-48e8-ace6-f334edce53fd]

ArgumentError: Invalid header in cache file /home/skainswo/.julia/compiled/v1.6/odecontrol/jl_uXlmeI.
WARNING: --output requested, but no modules defined during run

```

odecontrol is the name of the top-level project. I completely deleted `~/.julia` prior to running this as well.

What could be causing this error? Why is Julia creating a cache file with an invalid header?

---

<div class="post-metadata">

**Author:** ![Samuel\_Ainsworth](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/samuel_ainsworth/32/15644_2.png) [@Samuel\_Ainsworth](https://discourse.julialang.org/u/Samuel_Ainsworth)\
**Post date:** [August 29, 2021, 1:18am UTC](https://discourse.julialang.org/t/project-precompilation-fails-with-argumenterror-invalid-header-in-cache-file/67256/2 "2021-08-29T01:18:46Z")

</div>

If you’re interested in reproducing this error, you can do the following (requires [Nix](https://nixos.org/)):

1. Clone [https://github.com/samuela/research/tree/b2ff21c3e5a098ba4feca38b79879f95b46ffdb3](https://github.com/samuela/research/tree/b2ff21c3e5a098ba4feca38b79879f95b46ffdb3).
2. cd into julia/odecontrol, and run `nix-shell`.
3. `rm -rf ~/.julia`
4. `julia --project`, and then `] precompile`

---

<div class="post-metadata">

**Author:** ![fplancke](https://avatars.discourse-cdn.com/v4/letter/f/b5ac83/32.png) [@fplancke](https://discourse.julialang.org/u/fplancke)\
**Post date:** [December 10, 2021, 11:08am UTC](https://discourse.julialang.org/t/project-precompilation-fails-with-argumenterror-invalid-header-in-cache-file/67256/3 "2021-12-10T11:08:05Z")

</div>

Would it be because odecontrol.jl does not define an actual module ?  
I got the same error on one of my files, apparently because of that.

I’d like a better error message in that case, though.

---

<div class="post-metadata">

**Author:** ![Samuel\_Ainsworth](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/samuel_ainsworth/32/15644_2.png) [@Samuel\_Ainsworth](https://discourse.julialang.org/u/Samuel_Ainsworth)\
**Post date:** [December 11, 2021, 10:18pm UTC](https://discourse.julialang.org/t/project-precompilation-fails-with-argumenterror-invalid-header-in-cache-file/67256/4 "2021-12-11T22:18:43Z")

</div>

Yes, it turns out that’s correct! I forgot to post an update but the resolution was to add an empty module file: [https://github.com/samuela/research/blob/master/julia/odecontrol/src/odecontrol.jl](https://github.com/samuela/research/blob/master/julia/odecontrol/src/odecontrol.jl)

---

<div class="post-metadata">

**Author:** ![fplancke](https://avatars.discourse-cdn.com/v4/letter/f/b5ac83/32.png) [@fplancke](https://discourse.julialang.org/u/fplancke)\
**Post date:** [December 14, 2021, 10:33am UTC](https://discourse.julialang.org/t/project-precompilation-fails-with-argumenterror-invalid-header-in-cache-file/67256/5 "2021-12-14T10:33:31Z")

</div>

Indeed, as I see from your correction, it has to be a module, so you added an empty module, not just an empty file. (“empty module file” = “(empty module) file” rather than “empty (module file)” 🙂 )
