{"id":"656984f8184c59fb","repo":"python-poetry/poetry","slug":"at-least-one-source-must-not-be-configured-as-exp","errorCode":null,"errorMessage":"At least one source must not be configured as 'explicit'.","messagePattern":"At least one source must not be configured as 'explicit'\\.","errorType":"exception","errorClass":"PoetryError","httpStatus":null,"severity":"error","filePath":"src/poetry/factory.py","lineNumber":199,"sourceCode":"            pool.add_repository(repository, priority=priority)\n            if repository.name.lower() == \"pypi\":\n                explicit_pypi = True\n\n        # Only add PyPI if no primary repository is configured\n        if not explicit_pypi:\n            if pool.has_primary_repositories():\n                if io.is_debug():\n                    io.write_line(\"Deactivating the PyPI repository\")\n            else:\n                pool.add_repository(\n                    cls.create_package_source(\n                        {\"name\": \"pypi\"}, config, disable_cache=disable_cache\n                    ),\n                    priority=Priority.PRIMARY,\n                )\n\n        if not pool.repositories:\n            raise PoetryError(\n                \"At least one source must not be configured as 'explicit'.\"\n            )\n\n        return pool\n\n    @classmethod\n    def create_package_source(\n        cls, source: dict[str, str], config: Config, disable_cache: bool = False\n    ) -> HTTPRepository:\n        from poetry.repositories.exceptions import InvalidSourceError\n        from poetry.repositories.legacy_repository import LegacyRepository\n        from poetry.repositories.pypi_repository import PyPiRepository\n        from poetry.repositories.single_page_repository import SinglePageRepository\n\n        try:\n            name = source[\"name\"]\n        except KeyError:\n            raise InvalidSourceError(\"Missing [name] in source.\")","sourceCodeStart":181,"sourceCodeEnd":217,"githubUrl":"https://github.com/python-poetry/poetry/blob/92b74dcfe348d0e01e14d40d6c1fa47a4ee04a54/src/poetry/factory.py#L181-L217","documentation":"`PoetryError` from `create_pool` (factory.py:198-201) when every configured source is marked `priority = \"explicit\"`, leaving the pool with no usable repository. Explicit sources are only consulted when directly named, so resolving any unqualified dependency would be impossible.","triggerScenarios":"In pyproject.toml `[[tool.poetry.source]]` all entries set `priority = \"explicit\"`; PyPI was also re-added as explicit.","commonSituations":"Locking down to private indexes but accidentally marking the primary one explicit; migrating a config and flipping all sources to explicit.","solutions":["Set at least one source to `priority = \"primary\"` (the default) or `\"secondary\"`.","Remove `priority = \"explicit\"` from the source you want to serve as default.","If PyPI should remain available, do not mark its entry explicit."],"exampleFix":"# before\n[[tool.poetry.source]]\nname = \"pypi\"\npriority = \"explicit\"\n# after\n[[tool.poetry.source]]\nname = \"pypi\"\npriority = \"primary\"","handlingStrategy":"validation","validationCode":"sources = poetry.local_config.get(\"source\", [])\nnon_explicit = [s for s in sources if s.get(\"priority\", \"primary\") != \"explicit\"]\nif not non_explicit:\n    raise SystemExit(\"mark at least one source as primary or secondary\")","typeGuard":"def has_non_explicit_source(sources: list[dict]) -> bool:\n    return any(s.get(\"priority\", \"primary\") != \"explicit\" for s in sources)","tryCatchPattern":null,"preventionTips":["Default at least one source to `primary` (omit `priority`).","Use `explicit` only for on-demand private indexes.","Run `poetry check` after editing the source list."],"tags":["sources","repository-pool","factory"],"analyzedSha":"92b74dcfe348d0e01e14d40d6c1fa47a4ee04a54","analyzedAt":"2026-08-04T20:33:34.072Z","schemaVersion":2}