Skip to content

Baffling error messages for a package not being included in the project file #8484

Closed
@lf-

Description

@lf-

Describe the bug

The error message from forgetting to include a package in the project file is positively baffling.

To Reproduce

cabal.project:

packages: .
programs/hsutils - [main●] » git clone https://github.com/dreixel/generic-deriving

programs/hsutils - [main●] » cabal v2-build lib:generic-deriving
cabal: Internal error in target matching. It should always be possible to find
a syntax that's sufficiently qualified to give an unambiguous match. However
when matching 'lib:generic-deriving' we found lib:generic-deriving
(unknown-component) which does not have an unambiguous syntax. The possible
syntax and the targets they match are as follows:
'lib:generic-deriving' which matches lib:generic-deriving (unknown-component),
:pkg:lib:lib:lib:file:generic-deriving (unknown-file)

Please use version-prefixed commands (e.g. v2-build or v1-build) to avoid ambiguity.

Expected behavior

I would like an error message that says somewhere in it "Perhaps you forgot to add the package to cabal.project".

System information

  • Operating system macOS 12.5.1
programs/hsutils - [main●] » cabal --version
cabal-install version 3.6.2.0
compiled using version 3.6.3.0 of the Cabal library
programs/hsutils - [main●] » ghc --version
The Glorious Glasgow Haskell Compilation System, version 9.2.4

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions