shards
shards copied to clipboard
exception: unreachable
When running shards install, it keeps failing with this exception.
Fetching https://github.com/jwoertink/lucky-cluster.git
Fetching https://github.com/jwaldrip/admiral.cr.git
Unhandled exception: unreachable (Exception)
from Shards::Solver::Graph#versions_for_refs<String, Shards::Dependency, Shards::Resolver+>:NoReturn
from Shards::Solver::Graph#add<Shards::Dependency>:Nil
from Shards::Solver#prepare<Bool>:Nil
from Shards::Commands::Install#run:Nil
from ~procProc(Array(String), Array(String), Nil)@src/cli.cr:39
from __crystal_main
from main
[11:20AM] my_app (develop)$ shards --version
Shards 0.9.0 [81ea693] (2019-08-07)
[11:21AM] my_app (develop)$ crystal -v
Crystal 0.30.0 (2019-08-05)
LLVM: 8.0.0
Default target: x86_64-apple-macosx
I'm not sure if it's admiral that's failing, or if it's the next one. If the next one, then I don't know what that one is. I don't include admiral directly. I'm not even sure which shard includes that as a dep. In any case, I can access both of those repos.
It'd be cool if there was an error like:
Unable to reach host: #{host_name}
Or something like that.
oh, interesting. Ok, so I see what happened.
I changed some shards versions, and I added a shard. Then I ran shards install which throws that exception. One of the versions I updated removed that admiral as a dependency. So I just ran shards update which ran fine. Now looking at the diff of my shard.lock, I see that admiral was removed.
I thought there used to be a message that said something like "run shards update instead", but maybe not? I guess in any case, this isn't really a bug, but more of a better error message here would greatly improve the experience.
The message is still here: https://github.com/crystal-lang/shards/blob/81ea69333b0b020eccdfd6c8f6f427e9724e135a/src/solver/graph.cr#L96
The problem is that the wrong overload is selected, which shouldn't happen (hence the unreachable raise) because we only ever request refs for the git resolver :/
Could you run with shards install --verbose to have a little more info of what Shards is doing that leads to the bug?
Here's the last bit with just that shard:
Fetching https://github.com/jwaldrip/admiral.cr.git
git fetch --all --quiet
git show 0892415a8775fe59ff4c6de6cb5b21da8c9acd8e:shard.yml
git log -n 1 --pretty=%H 0892415a8775fe59ff4c6de6cb5b21da8c9acd8e
git show 0892415a8775fe59ff4c6de6cb5b21da8c9acd8e:shard.yml
Unhandled exception: unreachable (Exception)
from Shards::Solver::Graph#versions_for_refs<String, Shards::Dependency, Shards::Resolver+>:NoReturn
from Shards::Solver::Graph#add<Shards::Dependency>:Nil
from Shards::Solver#prepare<Bool>:Nil
from Shards::Commands::Install#run:Nil
from ~procProc(Array(String), Array(String), Nil)@src/cli.cr:39
from __crystal_main
from main
I have one also.
Fetching https://github.com/crystal-lang/crystal-sqlite3.git
git fetch --all --quiet
git tag --list --column=never
versions: 0.9.0, 0.8.3, 0.8.2, 0.8.1, 0.8.0, 0.7.0, 0.6.0, 0.5.0, 0.4.0, 0.3.0, 0.2.0, 0.16.0, 0.15.0, 0.14.0, 0.13.0, 0.12.0, 0.11.0, 0.10.0, 0.1.0
git ls-tree -r --full-tree --name-only v0.14.0 -- shard.yml
git show v0.14.0:shard.yml
Unhandled exception: unreachable (Exception)
from Shards::MolinilloSolver#versions_for_refs<String, Shards::Dependency, Shards::Resolver+>:NoReturn
from Shards::MolinilloSolver#search_for<Shards::Dependency>:Array(Shards::Spec)
from Molinillo::Resolver::Resolution(Shards::Dependency, Shards::Spec)@Molinillo::Resolver::Resolution(R, S)#push_state_for_requirements<Array(Shards::Dependency), Bool, Molinillo::DependencyGraph(Molinillo::Resolver::Resolution::PossibilitySet(Shards::Dependency, Shards::Spec) | Shards::Spec | Nil, Shards::Dependency)>:Array(Molinillo::ResolutionState(Shards::Dependency, Shards::Spec)+)
from Molinillo::Resolver::Resolution(Shards::Dependency, Shards::Spec)@Molinillo::Resolver::Resolution(R, S)#attempt_to_activate:(Array(Molinillo::ResolutionState(Shards::Dependency, Shards::Spec)+) | Hash(String, Molinillo::Resolver::Resolution::Conflict(Shards::Dependency, Shards::Spec))+)
from Shards::MolinilloSolver#solve:Array(Shards::Package)
from ~procProc(Array(String), Array(String), Nil)@src/cli.cr:39