Skip to content

feat(errors): Improve error message for incorrect package UUID#4270

Merged
KristofferC merged 2 commits intomasterfrom
kc/uuid_mismatch
Jun 27, 2025
Merged

feat(errors): Improve error message for incorrect package UUID#4270
KristofferC merged 2 commits intomasterfrom
kc/uuid_mismatch

Conversation

@KristofferC
Copy link
Copy Markdown
Member

When a user attempts to add a package with a correct name but an incorrect UUID, the error message was previously a generic "package not registered". This could leave the user unsure of the root cause.

This commit enhances the error handling to detect this specific scenario. If the provided package name exists in the registry but with a different UUID, the error message will now include the correct UUID(s) found for that package name, guiding the user toward the correct command.

A new test case is added to ensure the new error message is triggered correctly and displays the expected information.

Fixes #4267

This commit was written by an AI assistant.

When a user attempts to add a package with a correct name but an
incorrect UUID, the error message was previously a generic "package not
registered". This could leave the user unsure of the root cause.

This commit enhances the error handling to detect this specific
scenario. If the provided package name exists in the registry but with a
different UUID, the error message will now include the correct UUID(s)
found for that package name, guiding the user toward the correct
command.

A new test case is added to ensure the new error message is triggered
correctly and displays the expected information.

Fixes #4267

This commit was written by an AI assistant.
Comment thread src/Operations.jl Outdated
if pkg.name !== nothing
uuids = Types.registered_uuids(registries, pkg.name)
if !isempty(uuids)
msg *= "\n You may have provided the wrong UUID for package $(pkg.name).\n Found the following UUIDs for that name: $(join(uuids, ", "))"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this tell you what registry it came from?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably, but I got rate limited on Google Gemini CLI so I guess this is as good as it gets 🤣

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Meh, I'll take it

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might be in luck, I might have been able to get some $300 free tier thingy.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

julia> Pkg.add(PackageSpec(name="Example", uuid=UUID(UInt128(2))))
   Resolving package versions...
ERROR: expected package `Example [00000000]` to be registered
 You may have provided the wrong UUID for package Example.
 Found the following UUIDs for that name:
  - 7876af07-990d-54b4-ab0e-23690620f79a from registry: General

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect

@KristofferC KristofferC merged commit eefbef6 into master Jun 27, 2025
9 checks passed
@KristofferC KristofferC deleted the kc/uuid_mismatch branch June 27, 2025 07:40
KristofferC added a commit that referenced this pull request Jul 1, 2025
@KristofferC KristofferC mentioned this pull request Jul 1, 2025
22 tasks
KristofferC added a commit that referenced this pull request Feb 20, 2026
@KristofferC KristofferC mentioned this pull request Feb 20, 2026
18 tasks
KristofferC added a commit that referenced this pull request Feb 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"Expected package to be registered" could suggest that a UUID mismatch may be the cause

2 participants