Error: Tree Hash Mismatch! only on MacOs for all julia versions

Hi all,
I have a package, Exodus.jl, that I’ve been working on for the past year or so. It is in the General registry and I’m currently experiencing a tree has mismatch for users trying to add the package on mac os only. I know I can circumvent this issue with the following environment variable trick

ENV["JULIA_PKG_IGNORE_HASHES"] = 1

but it seems a little non user friendly for those using Mac.

Here is the stack trace when trying to add the package on mac after typing

pkg> add Exodus
ERROR: LoadError: Unable to automatically download/install artifact 'Exodus' from sources listed in '/Users/runner/.julia/packages/Exodus_jll/ykNCT/Artifacts.toml'.
Sources attempted:
- https://pkg.julialang.org/artifact/21cf8e25ed9bfa1031d9f4eed57a2ab7b4ff1493
    Error: Tree Hash Mismatch!
  Expected git-tree-sha1:   21cf8e25ed9bfa1031d9f4eed57a2ab7b4ff1493
  Calculated git-tree-sha1: d201e96a38e01ca3779200e765f568d1c80f9f02
- https://github.com/JuliaBinaryWrappers/Exodus_jll.jl/releases/download/Exodus-v8.19.0+0/Exodus.v8.19.0.x86_64-apple-darwin.tar.gz
    Error: Tree Hash Mismatch!
  Expected git-tree-sha1:   21cf8e25ed9bfa1031d9f4eed57a2ab7b4ff1493
  Calculated git-tree-sha1: d201e96a38e01ca3779200e765f568d1c80f9f02

Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:35
 [2] ensure_artifact_installed(name::String, meta::Dict{String, Any}, artifacts_toml::String; platform::Base.BinaryPlatforms.Platform, verbose::Bool, quiet_download::Bool, io::IOContext{Base.PipeEndpoint})
   @ Pkg.Artifacts ~/hostedtoolcache/julia/1.8.5/x64/share/julia/stdlib/v1.8/Pkg/src/Artifacts.jl:468
 [3] download_artifacts(env::Pkg.Types.EnvCache; platform::Base.BinaryPlatforms.Platform, julia_version::VersionNumber, verbose::Bool, io::IOContext{Base.PipeEndpoint})
   @ Pkg.Operations ~/hostedtoolcache/julia/1.8.5/x64/share/julia/stdlib/v1.8/Pkg/src/Operations.jl:665
 [4] instantiate(ctx::Pkg.Types.Context; manifest::Nothing, update_registry::Bool, verbose::Bool, platform::Base.BinaryPlatforms.Platform, allow_build::Bool, allow_autoprecomp::Bool, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ Pkg.API ~/hostedtoolcache/julia/1.8.5/x64/share/julia/stdlib/v1.8/Pkg/src/API.jl:1601
 [5] build(ctx::Pkg.Types.Context, uuids::Set{Base.UUID}, verbose::Bool)
   @ Pkg.Operations ~/hostedtoolcache/julia/1.8.5/x64/share/julia/stdlib/v1.8/Pkg/src/Operations.jl:895
 [6] build(ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec}; verbose::Bool, kwargs::Base.Pairs{Symbol, IOContext{Base.PipeEndpoint}, Tuple{Symbol}, NamedTuple{(:io,), Tuple{IOContext{Base.PipeEndpoint}}}})
   @ Pkg.API ~/hostedtoolcache/julia/1.8.5/x64/share/julia/stdlib/v1.8/Pkg/src/API.jl:1029
 [7] build(pkgs::Vector{Pkg.Types.PackageSpec}; io::IOContext{Base.PipeEndpoint}, kwargs::Base.Pairs{Symbol, Bool, Tuple{Symbol}, NamedTuple{(:verbose,), Tuple{Bool}}})
   @ Pkg.API ~/hostedtoolcache/julia/1.8.5/x64/share/julia/stdlib/v1.8/Pkg/src/API.jl:156
 [8] build(; name::Nothing, uuid::Nothing, version::Nothing, url::Nothing, rev::Nothing, path::Nothing, mode::Pkg.Types.PackageMode, subdir::Nothing, kwargs::Base.Pairs{Symbol, Bool, Tuple{Symbol}, NamedTuple{(:verbose,), Tuple{Bool}}})
   @ Pkg.API ~/hostedtoolcache/julia/1.8.5/x64/share/julia/stdlib/v1.8/Pkg/src/API.jl:171
 [9] top-level scope
   @ ~/work/_temp/ceda7fb7-520f-479a-a743-ca5ff345112c:3
in expression starting at /Users/runner/work/_temp/ceda7fb7-520f-479a-a743-ca5ff345112c:3

Does anyone know how I can fix this issue?

Thanks!

Why is that non-user-friendly and why that’s non-user-friendly specifically for those using macOS (especially since the syntax is the same for all operating systems)?

Tree hashes mismatches are usually filesystem-related, a couple of common situations are:

  • in the tarball there might be files with clashing names due to different cases, this is a problem on case-insensitive file systems (which is the default on macOS)
  • you may have an uncommon filesystem on which the tree hash is computed differently

If the problem is the former, the solution is to remove files which clashing file names.

1 Like

I wasn’t trying to say the syntax was not user friendly but rather that it makes my package less user friendly for a mac user if they have to type this additional environment variable command.

Thanks for the concise answer! I’ll try to purge my package of any clashing file names.