Poetry config can be messed up by incorrect user command
Description
I think I was able to bork my poetry environment by using this command
poetry config -- repositories.repo2.url "https://us-python.pkg.dev/org/repo/"
The correct command is
poetry config -- repositories.repo2 "https://us-python.pkg.dev/org/repo/"
All subsequent commands to try to modify my poetry config failed
Looks like my config file /Users/user/Library/Application Support/pypoetry/config.toml ended up getting borked as follows (note the .url at end of last entry)
[repositories.repo1]
url = "https://us-python.pkg.dev/org/repo/"
[repositories.repo2.url]
url = "https://us-python.pkg.dev/org/repo/"
Workarounds
Remove the config file or manually edit it
Poetry Installation Method
pipx
Operating System
macOS 15.6.1
Poetry Version
2.2.1
Poetry Configuration
unhashable type: 'dict'
Python Sysconfig
sysconfig.log
$ poetry config listunhashable type: 'dict'
$ poetry -vv debug info
Poetry
Stack trace:
18 ~/.local/pipx/venvs/poetry/lib/python3.13/site-packages/cleo/application.py:327 in run exit_code = self._run(io)
17 ~/.local/pipx/venvs/poetry/lib/python3.13/site-packages/poetry/console/application.py:260 in _run exit_code = super()._run(io)
16 ~/.local/pipx/venvs/poetry/lib/python3.13/site-packages/cleo/application.py:431 in _run exit_code = self._run_command(command, io)
15 ~/.local/pipx/venvs/poetry/lib/python3.13/site-packages/cleo/application.py:473 in _run_command raise error
14 ~/.local/pipx/venvs/poetry/lib/python3.13/site-packages/cleo/application.py:457 in _run_command exit_code = command.run(io)
13 ~/.local/pipx/venvs/poetry/lib/python3.13/site-packages/cleo/commands/base_command.py:117 in run return self.execute(io) or 0
12 ~/.local/pipx/venvs/poetry/lib/python3.13/site-packages/cleo/commands/command.py:61 in execute return self.handle()
11 ~/.local/pipx/venvs/poetry/lib/python3.13/site-packages/poetry/console/commands/debug/info.py:20 in handle f"Version: {self.poetry.VERSION}",
10 ~/.local/pipx/venvs/poetry/lib/python3.13/site-packages/poetry/console/commands/command.py:24 in poetry return self.get_application().poetry
9 ~/.local/pipx/venvs/poetry/lib/python3.13/site-packages/poetry/console/application.py:199 in poetry self._poetry = Factory().create_poetry(
8 ~/.local/pipx/venvs/poetry/lib/python3.13/site-packages/poetry/factory.py:106 in create_poetry self.create_pool(
7 ~/.local/pipx/venvs/poetry/lib/python3.13/site-packages/poetry/factory.py:164 in create_pool cls.create_package_source(
6 ~/.local/pipx/venvs/poetry/lib/python3.13/site-packages/poetry/factory.py:198 in create_package_source return PyPiRepository(
5 ~/.local/pipx/venvs/poetry/lib/python3.13/site-packages/poetry/repositories/pypi_repository.py:50 in init super().init(
4 ~/.local/pipx/venvs/poetry/lib/python3.13/site-packages/poetry/repositories/http_repository.py:67 in init self._authenticator.add_repository(name, url)
3 ~/.local/pipx/venvs/poetry/lib/python3.13/site-packages/poetry/utils/authenticator.py:404 in add_repository self.configured_repositories[name] = AuthenticatorRepositoryConfig(name, url)
2 ~/.local/pipx/venvs/poetry/lib/python3.13/site-packages/poetry/utils/authenticator.py:394 in configured_repositories AuthenticatorRepositoryConfig(repository_name, url)
1
TypeError
unhashable type: 'dict'
at ~/.local/pipx/venvs/poetry/lib/python3.13/site-packages/poetry/utils/authenticator.py:75 in post_init 71│ netloc: str = dataclasses.field(init=False) 72│ path: str = dataclasses.field(init=False) 73│ 74│ def post_init(self) -> None: → 75│ parsed_url = urllib.parse.urlsplit(self.url) 76│ self.netloc = parsed_url.netloc 77│ self.path = parsed_url.path 78│ 79│ def certs(self, config: Config) -> RepositoryCertificateConfig: $ poetry about Poetry - Package Management for Python
Version: 2.2.1 Poetry-Core Version: 2.2.1
Poetry is a dependency manager tracking local dependencies of your projects and libraries. See https://github.com/python-poetry/poetry for more information.
Example pyproject.toml
Poetry Runtime Logs
poetry-runtime.log
Paste the output of 'poetry -vvv <command>', over this line.
All subsequent commands to try to modify my poetry config failed
you forgot to say what you tried, or what went wrong