New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Confusing error message with duplicate package specification #9394
Confusing error message with duplicate package specification #9394
Comments
as you can see, this is coming from the standard library's toml parser. It is beyond poetry's power to change that. Given that it points to the exact line and character where you had a bug, I suppose this was not very confusing. |
@dimbleby could Poetry not catch the exception where it calls the toml parser and output a nicer error? |
Really I am not persuaded that this is confusing in the first place: it's a TOML decode error that points to the exact place in the toml where there is a problem. If anyone cares to contribute a change to poetry then no doubt maintainers will take a view on that contribution, but imo there is no need to do anything here. |
@dimbleby You're absolutely correct in that it tells you the exact location in the file where there is an issue, but it isn't at all immediately clear that the issue is the entry is duplicated (especially in a project with more than a handful of dependencies) I'll take a look to see if I can come up with a nice way to handle the exception as I also completely agree with you that inspecting the text of the error could be brittle. |
With it speaking about failing to write a value ( The error doesn't even say which toml file, and it's talking about writing while it actually is reading a file. But this issue helped, in my case it also was a duplicated line. |
Yeah it would be nice if poetry would specify that the error came from the # snip...
[tool.poetry.group.dev.dependencies]
ruff = "^0.4.4"
<<<<<<< HEAD
hypothesis = "^6.102.4"
=======
pytest = "^8.2.1"
>>>>>>> main
# snip...
|
It doesn't need to be very confusing to confuse idiots like myself. A little bit of context from Poetry (e.g. "There was an issue parsing your pyproject.toml, please make sure it is valid TOML") would have gone a long way to indicating to me that there was an issue with my TOML in the first place. You could argue that the fact that it raised a |
the file is opened here, y'all are encouraged to submit a pull request catching the tomllib exception and raising a new one with a mention of the filename |
Description
When accidentally duplicating a package specification in
pyproject.toml
,poetry install
throws a very cryptic message like:Workarounds
Finding and removing the duplicate package specification ultimately solves the issue, but its hard to first know that there is a duplicate without a nicer error message.
Poetry Installation Method
pipx
Operating System
MacOS Ventura 13.3.1 (a)
Poetry Version
Poetry (version 1.8.2)
Poetry Configuration
Example pyproject.toml
Poetry Runtime Logs
The text was updated successfully, but these errors were encountered: