{"id":"ba05e30aade76b1b","repo":"python-poetry/poetry","slug":"you-must-pass-the-url-example-poetry-config-repo","errorCode":null,"errorMessage":"You must pass the url. Example: poetry config repositories.foo https://bar.com","messagePattern":"You must pass the url\\. Example: poetry config repositories\\.foo https://bar\\.com","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/poetry/console/commands/config.py","lineNumber":264,"sourceCode":"                    # Unset a specific sub-property\n                    config.config_source.remove_property(\n                        [\"repositories\", repo_name, m.group(2)]\n                    )\n                else:\n                    config.config_source.remove_property([\"repositories\", repo_name])\n\n                return 0\n\n            if len(values) == 1:\n                url = values[0]\n\n                config.config_source.add_property(\n                    [\"repositories\", repo_name, \"url\"], url\n                )\n\n                return 0\n\n            raise ValueError(\n                \"You must pass the url. \"\n                \"Example: poetry config repositories.foo https://bar.com\"\n            )\n\n        # handle auth\n        m = re.match(r\"^(http-basic|pypi-token)\\.(.+)\", self.argument(\"key\"))\n        if m:\n            from poetry.utils.password_manager import PasswordManager\n\n            password_manager = PasswordManager(config)\n            if self.option(\"unset\"):\n                if m.group(1) == \"http-basic\":\n                    password_manager.delete_http_password(m.group(2))\n                elif m.group(1) == \"pypi-token\":\n                    password_manager.delete_pypi_token(m.group(2))\n\n                return 0\n","sourceCodeStart":246,"sourceCodeEnd":282,"githubUrl":"https://github.com/python-poetry/poetry/blob/92b74dcfe348d0e01e14d40d6c1fa47a4ee04a54/src/poetry/console/commands/config.py#L246-L282","documentation":"Raises ValueError in ConfigCommand.handle() when setting a repository but the number of values provided is not exactly 1. A repository needs a single URL argument; providing zero values (impossible due to earlier checks) or 2+ values triggers this. The check at line 255-267: if len(values) != 1, the error is raised after the len(values) == 1 success branch.","triggerScenarios":"Running `poetry config repositories.myrepo https://a.com https://b.com` (two URLs) — len(values) is 2, not 1.","commonSituations":"User passes multiple URLs by mistake, or passes additional arguments that get collected into the multiple=True value argument.","solutions":["Provide exactly one URL: `poetry config repositories.myrepo https://example.com/simple/`."],"exampleFix":"# before (error)\npoetry config repositories.myrepo https://a.com https://b.com\n# after\npoetry config repositories.myrepo https://example.com/simple/","handlingStrategy":"validation","validationCode":"def validate_repo_url(values: list[str]) -> None:\n    if len(values) != 1:\n        raise ValueError(\n            f\"Expected exactly 1 URL, got {len(values)}. \"\n            \"Example: poetry config repositories.foo https://bar.com\"\n        )","typeGuard":"def has_single_url(values: list[str]) -> bool:\n    return len(values) == 1","tryCatchPattern":null,"preventionTips":["Pass exactly one URL argument when setting a repository.","Avoid trailing stray arguments that get collected into the multiple value argument.","Quote URLs containing special characters."],"tags":["config-command","valueerror","repositories","wrong-arg-count","cli-validation"],"analyzedSha":"92b74dcfe348d0e01e14d40d6c1fa47a4ee04a54","analyzedAt":"2026-08-04T20:33:34.072Z","schemaVersion":2}