Slightly misleading error message when adding a repository with wrong url

Open Beginner friendly
#6,943 3 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
64/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
ocaml
Domain
cli

Research direction

Start at the opam repository command entry points for adding a repository and changing its URL, and locate the existing “Repository repo is already set up” error text. Update the message to explain that the mapping is global and distinguish adding it to the current switch from changing its address; done when the resulting error clearly covers both cases.

Written by the indexing model from the issue text.

Description

AREA: UI easy first issue

When a repository name has already been assigned (globally, but the user isn't aware) and added to one switch, then tried to be added with another url in another switch, the error message can be a bit confusing:
[ERROR] Repository repo is already set up and points to https://example.org/repo. To change that, use 'opam repository set-url repo https://example.org/repo2'.

I think the information that the mapping is global and that the set up may have happened in another switch should be made more explicit.
Maybe something like this?

[ERROR] Repository repo has already been globally set up and points to https://example.org/repo.
To add the repository to the current switch with this address, use 'opam repository add repo';
to change the address, use 'opam repository set-url repo https://example.org/repo2'.
Dominant language
OCaml
Stars
1.4k
Forks
410
Avg merge
2d 6h
Merged PRs (30d)
15

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ocaml/opam

All issues in ocaml/opam

Similar issues

More CLI issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.