haskell / haskell/cabal

"cabal: Internal error in target matching" (was: Internal error/infinite loop in D.Client.TargetSelector)

Open
#5,081 7 comments 0 reactions 0 assignees View on GitHub
attention: pr-welcome cabal-install: v2-build system re: internal-error re: target type: bug
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

I reproduced the issue on master (378153142745135c203f8301a2af16fe55528ea2) by running the following command in the cabal repository:

```
$ cabal new-build test:unknown-test-suite
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 'test:unknown-test-suite' we found test:unknown-test-suite
(unknown-component) which does not have an unambiguous syntax. The possible
syntax and the targets they match are as follows:
cabal: <>
```

It also occurs when I run the same command on a simple project with one directory containing a simple .cabal file:

```
name: example
version: 1.0
build-type: Simple
cabal-version: >= 1.2

library
```

The error message is from D.Client.TargetSelector: https://github.com/haskell/cabal/blob/378153142745135c203f8301a2af16fe55528ea2/cabal-install/Distribution/Client/TargetSelector.hs#L653

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.