Skip to content

Ambiguous module name in multiple packages message not clear #12155

Description

@philderbeast

Describe the bug
I was trying to see if #12126 fixes #11796 but hit another problem. Trying to run cabal doctest in cabal-install or make doctest-install && make doctest with ghc-9.14.1, I'm seeing this error:

Ambiguous module name ‘Network.URI’.
              it was found in multiple packages:
              network-uri-2.6.4.2 network-uri-2.6.4.2 network-uri-2.6.4.2 network-uri-2.6.4.2 network-uri-2.6.4.2 network-uri-2.6.4.2 network-uri-2.6.4.2 network-uri-2.6.4.2 network-uri-2.6.4.2 network-uri-2.6.4.2 network-uri-2.6.4.2 network-uri-2.6.4.2

To Reproduce

$ make doctest-install
$ cd cabal-install
$ ~/.ghcup/bin/cabal doctest
...
$ cabal doctest
...
doctest version 0.25.0
using version 9.14.1 of the GHC API
using /home/.../.ghcup/ghc/9.14.1/bin/ghc-9.14.1
Warning: this is a debug build of cabal-install with assertions enabled.
Configuration is affected by cabal.project at
'/home/.../cabal'.
Resolving dependencies...
Build profile: -w ghc-9.14.1 -O1
In order, the following will be built (use -v for more details):
 - cabal-install-3.17.0.0 (interactive) (lib) (first run)
Preprocessing library for cabal-install-3.17.0.0...
/home/.../cabal/cabal-install/src/Distribution/Client/Types/Repo.hs:234: failure in expression `import Network.URI'
expected: 
 but got: <no location info>: error: [GHC-45102]
          ^
              Ambiguous module name ‘Network.URI’.
              it was found in multiple packages:
              network-uri-2.6.4.2 network-uri-2.6.4.2 network-uri-2.6.4.2 network-uri-2.6.4.2 network-uri-2.6.4.2 network-uri-2.6.4.2 network-uri-2.6.4.2 network-uri-2.6.4.2 network-uri-2.6.4.2 network-uri-2.6.4.2 network-uri-2.6.4.2 network-uri-2.6.4.2
          
Examples: 56  Tried: 50  Errors: 0  Failures: 1

Expected behavior
That the error message would better describe the problem. These packages look to be all the same but on my system they're not.

$ find ~/.local/state/cabal/store/ghc-9.14.1-c6c3 -type d -name 'network-uri*' -printf '%f\n'
network-uri-2.6.4.2-cb2caf33a3c2c11211e63e0182655d8f4a7ea3da0265764e46e22e2e9177b22c
network-uri-2.6.4.2-2358c204505d73dc0be52f50d32b3b906a17195e8fdfaf8f194bea7223ed856c
network-uri-2.6.4.2-1189fd4b94c6a95e2f00ab104d79a33b5c7b8b7ad2732c3cabfb1da6b3beee23
network-uri-2.6.4.2-7a8591a999243fd975ca52114b9675de7d6f2270e130208b4a60815e5514f9f6
network-uri-2.6.4.2-7f4c247dbadf2d4d64283c386b93f293cd869c4af80b03151433712116a730e9
network-uri-2.6.4.2-665f380332cd742974edab0d78bfb4501b690422e919302722fe646cb8e750e8
network-uri-2.6.4.2-ca6b154d7eca4c224732eddcfc069e2b81b0921e1a0a3602c26852c61a960556
network-uri-2.6.4.2-6e1500520032b15e2d1f080007e199cad6528bdfd9020e5df11156134cc01fa5
network-uri-2.6.4.2-730ff294181782f8528e38d355b9140e0db515d5002a729be4efc75a97619530
network-uri-2.6.4.2-95d27f815410e1cc77eedc72c9c7cf42a9268a687166e2616a0387e61acc253a
network-uri-2.6.4.2-74e7bb592eedc12123ded00ddcdc63760a7ba7fea3e5752d572d9e41a93d4616
network-uri-2.6.4.2-94462c7c08ecf5330ecf45950429ecd3840f812edcb023a9d5a7f4b4cbc0f3f5

System information

$ ~/.ghcup/bin/cabal --numeric-version
3.16.1.0

$ ghc --numeric-version
9.14.1

$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 26.04 LTS
Release:	26.04
Codename:	resolute

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions