# Cryptic error messages, no idea what to do

**URL:** <https://discourse.julialang.org/t/cryptic-error-messages-no-idea-what-to-do/121264>\
**Category:** General Usage\
**Created:** [October 13, 2024, 8:49pm UTC](https://discourse.julialang.org/t/cryptic-error-messages-no-idea-what-to-do/121264 "2024-10-13T20:49:28Z")\
**Posts on this page:** 6\
**Page:** 2

<div class="post-metadata">

**Author:** ![tb877](https://avatars.discourse-cdn.com/v4/letter/t/d26b3c/32.png) [@tb877](https://discourse.julialang.org/u/tb877)\
**Post date:** [October 14, 2024, 6:29pm UTC](https://discourse.julialang.org/t/cryptic-error-messages-no-idea-what-to-do/121264/21 "2024-10-14T18:29:18Z")

</div>

Yeah actually it’s not the startup file that was causing package version issues but the environment that was loaded. So the real issue here is to avoid loading packages having version X in the default environment then trying to load version Y in the project manifest as @nhz2 mentioned. And ideally, doing that through `DrWatson`’s `@quickactivate` as to avoid hard-coding relative paths in all my julia scripts.

Sorry for the confusion, I’m still getting used to the way Julia works!

---

<div class="post-metadata">

**Author:** ![nsajko](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nsajko/32/221187_2.png) [@nsajko](https://discourse.julialang.org/u/nsajko)\
**Post date:** [October 14, 2024, 7:25pm UTC](https://discourse.julialang.org/t/cryptic-error-messages-no-idea-what-to-do/121264/22 "2024-10-14T19:25:16Z")

</div>

> [@tb877](#):
>
> And ideally, doing that through `DrWatson`’s `@quickactivate` as to avoid hard-coding relative paths in all my julia scripts.

I’m not sure the premise here is correct. I never used DrWatson.jl, but I just read its docs and reminded myself of the relevant Julia docs:

- [Introduction · DrWatson.jl](https://juliadynamics.github.io/DrWatson.jl/stable/)
  - [`quickactivate`](https://juliadynamics.github.io/DrWatson.jl/stable/project/#DrWatson.quickactivate)
  - [`@quickactivate`](https://juliadynamics.github.io/DrWatson.jl/stable/project/#DrWatson.@quickactivate)

- [Command-line switches for Julia](https://docs.julialang.org/en/v1/manual/command-line-interface/#command-line-interface)
  - 

> `--project[={<dir>|@.}]`
> 
> - Set `<dir>` as the active project/environment. The default `@.` option will search through parent directories until a `Project.toml` or `JuliaProject.toml` file is found.

- [Environments](https://docs.julialang.org/en/v1/manual/code-loading/#Environments)

So using the `--project` (without additional arguments) startup option for `julia` already provides the functionality of recursively searching parent directories for a project.

Does simply adding `--project` to your startup options resolve your issues?

Lastly, I’m not sure what do you mean by this:

> avoid hard-coding relative paths in all my julia scripts

---

<div class="post-metadata">

**Author:** ![tb877](https://avatars.discourse-cdn.com/v4/letter/t/d26b3c/32.png) [@tb877](https://discourse.julialang.org/u/tb877)\
**Post date:** [October 14, 2024, 11:53pm UTC](https://discourse.julialang.org/t/cryptic-error-messages-no-idea-what-to-do/121264/23 "2024-10-14T23:53:18Z")

</div>

> [@nsajko](#):
>
> So using the `--project` (without additional arguments) startup option for `julia` already provides the functionality of recursively searching parent directories for a project.

Humm this is interesting! I fully agree that’s the way I _would like_ Julia to behave! However, either there’s something I don’t understand, or it just doesn’t work that way. Loading the `julia` executable in my module’s folder (or any of its subfolders) doesn’t seem to load the environment:

```julia-auto
julia> using Pkg

julia> Pkg.status()
Status `~/.julia/environments/v1.11/Project.toml`

```

It should show the `toml` file from my module, no?

**edit** never mind, it works by invoking the option without any argument, i.e.

```julia-auto
julia --project

```

I could then just create an alias from `julia` to `julia --project` I guess.

---

<div class="post-metadata">

**Author:** ![TheCedarPrince](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thecedarprince/32/17323_2.png) [@TheCedarPrince](https://discourse.julialang.org/u/TheCedarPrince)\
**Post date:** [October 15, 2024, 2:26am UTC](https://discourse.julialang.org/t/cryptic-error-messages-no-idea-what-to-do/121264/24 "2024-10-15T02:26:01Z")

</div>

This is quite a bizarre error to be having with DrWatson.jl – let me ping the creator @Datseris so he can see this (if he hasn’t already). I am a huge DrWatson.jl fan so to be seeing these many issues is very strange to me when I have barely ever ran into problems with it in my four years of use of the package.

P.S. Four years. Wow. I am getting old. 👴

---

<div class="post-metadata">

**Author:** ![nhz2](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nhz2/32/44428_2.png) [@nhz2](https://discourse.julialang.org/u/nhz2)\
**Post date:** [October 15, 2024, 3:49am UTC](https://discourse.julialang.org/t/cryptic-error-messages-no-idea-what-to-do/121264/25 "2024-10-15T03:49:43Z")

</div>

I think the new `--project=@script` option would do what you want when it is working [`--project=@script` is broken or NEWS entry is incorrect (Julia 1.11.0-rc3) · Issue #55606 · JuliaLang/julia · GitHub](https://github.com/JuliaLang/julia/issues/55606) [`--project=@script` does not activate script project if outside of the Project Directory · Issue #55069 · JuliaLang/julia · GitHub](https://github.com/JuliaLang/julia/issues/55069)

Then you could add something like the following to the file’s shebang:

```sh
#!/usr/bin/env -S JULIA_LOAD_PATH="@" julia +1.11 --startup-file=no --project=@script

```

---

<div class="post-metadata">

**Author:** ![tb877](https://avatars.discourse-cdn.com/v4/letter/t/d26b3c/32.png) [@tb877](https://discourse.julialang.org/u/tb877)\
**Post date:** [October 15, 2024, 5:05pm UTC](https://discourse.julialang.org/t/cryptic-error-messages-no-idea-what-to-do/121264/26 "2024-10-15T17:05:15Z")

</div>

Interesting thanks! I’ll look into that!

[Previous page](https://discourse.julialang.org/t/cryptic-error-messages-no-idea-what-to-do/121264.md?page=1)
