Skip to content

Cabal init fails with 'no package name provided' if name is already taken on hackage #7273

Closed

Description

@Mistuke

Describe the bug
When I do cabal init this doesn't prompt me for anything and just dies.

Guessing dependencies...

Generating LICENSE...
Warning: unknown license type, you must put a copy in LICENSE yourself.
Generating Setup.hs...
Generating CHANGELOG.md...
Generating Main.hs...
Error: no package name provided.

explicitly specifying interactive mode gets:

Should I generate a simple project with sensible defaults? [default: y] y

Guessing dependencies...

Generating LICENSE...
Warning: unknown license type, you must put a copy in LICENSE yourself.
Generating Setup.hs...
Warning: Setup.hs already exists, backing up old version in Setup.hs.save0
Generating CHANGELOG.md...
Warning: CHANGELOG.md already exists, backing up old version in CHANGELOG.md.save0
Error: no package name provided.

and the cabal file is never created. Only

CHANGELOG.md  Main.hs  Setup.hs

To Reproduce
Steps to reproduce the behavior:

$ cabal init

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

Expected behavior
A clear and concise description of what you expected to happen.

System information

  • Operating system: Windows 10 (bash or powershell)
  • cabal, ghc versions: 3.2.0.0 and 8.8.4

Additional context
Add any other context about the problem here.

Activity

  1. fgaz commented on Feb 7, 2021

    @fgaz
    Member

    Does this happen in any directory or just in ones with specific names?

  2. Mistuke commented on Feb 7, 2021

    @Mistuke
    CollaboratorAuthor

    @fgaz wow.. it's... very interesting... I've tried in a number of directories and they work, but if I create a directory named monarch anywhere... cabal init fails with the error above..

  3. jhrcek commented on Feb 7, 2021

    @jhrcek
    Contributor

    It's probably because there already is package with the name like that on hackage: http://hackage.haskell.org/package/monarch
    I saw issue like that in the past: #6236

  4. Mistuke commented on Feb 7, 2021

    @Mistuke
    CollaboratorAuthor

    Oh wow, that does sound like the issue indeed

  5. Mistuke commented on Feb 7, 2021

    @Mistuke
    CollaboratorAuthor

    The fix seems relatively recent. I'll try cabal 3.4 rc5

  6. emilypi commented on Feb 8, 2021

    @emilypi
    Member

    Yeah, this is the dumb "if the package name already exists, it'll crap out with no reasonable error" workflow. I'm adding this to my work on #7265

  7. andreasabel commented on Feb 18, 2021

    @andreasabel
    Member

    Please update the title of this issue to something less generic, e.g. "Cabal init fails with 'no package name provided' if name is already taken on hackage".

  8. changed the title [-]Cabal init doesn't seem to work[/-] [+]Cabal init fails with 'no package name provided' if name is already taken on hackage[/+] on May 14, 2021
  9. KristianBalaj commented on Jan 18, 2022

    @KristianBalaj

    This issue is still appearing with cabal 3.4.1.0

    I named the directory streaming and the cabal init failed with the error.

  10. Mikolaj commented on Jan 19, 2022

    @Mikolaj
    Member

    Hi @KristianBalaj,

    Hi! It works fine on master branch (to be released as 3.8; I haven't tried with 3.6.2). It asks you whether you want to name the package so anyway and then proceeds fine. Please confirm.

  11. KristianBalaj commented on Jan 20, 2022

    @KristianBalaj

    @Mikolaj
    The following is the behaviour with cabal 3.4.1.0, it does not ask for anything:

    image

  12. Mikolaj commented on Jan 20, 2022

    @Mikolaj
    Member

    @KristianBalaj: thank you for checking. I guess you need to upgrade?

  13. KristianBalaj commented on Jan 20, 2022

    @KristianBalaj

    Yeah sure, I was just reporting that in that version of cabal it is still an issue.

  14. Mikolaj commented on Jan 20, 2022

    @Mikolaj
    Member

    Thank you again. I guess you may need (regardless of upgrading) to run cabal init in interactive mode to enable the choice. No needed on the master branch, which is interactive by default now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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