{"record":{"id":"28710f2c53d35ca1","repo":"pypa/pip","slug":"error-parsing-entry-points-for-self-raw-name-e-28710f","errorCode":null,"errorMessage":"Error parsing entry points for {self.raw_name}: {e}","messagePattern":"Error parsing entry points for (.+?): (.+?)","errorType":"exception","errorClass":"InstallationError","httpStatus":null,"severity":"error","filePath":"src/pip/_internal/metadata/pkg_resources.py","lineNumber":219,"sourceCode":"        return self._dist.has_metadata(str(path))\n\n    def iter_distutils_script_names(self) -> Iterator[str]:\n        yield from self._dist.metadata_listdir(\"scripts\")\n\n    def read_text(self, path: InfoPath) -> str:\n        name = str(path)\n        if not self._dist.has_metadata(name):\n            raise FileNotFoundError(name)\n        content = self._dist.get_metadata(name)\n        if content is None:\n            raise NoneMetadataError(self, name)\n        return content\n\n    def iter_entry_points(self) -> Iterable[BaseEntryPoint]:\n        try:\n            entry_map = self._dist.get_entry_map()\n        except ValueError as e:\n            raise InstallationError(\n                f\"Error parsing entry points for {self.raw_name}: {e}\"\n            ) from e\n        for group, entries in entry_map.items():\n            for name, entry_point in entries.items():\n                name, _, value = str(entry_point).partition(\"=\")\n                yield EntryPoint(name=name.strip(), value=value.strip(), group=group)\n\n    def _metadata_impl(self) -> email.message.Message:\n        \"\"\"\n        :raises NoneMetadataError: if the distribution reports `has_metadata()`\n            True but `get_metadata()` returns None.\n        \"\"\"\n        if isinstance(self._dist, pkg_resources.DistInfoDistribution):\n            metadata_name = \"METADATA\"\n        else:\n            metadata_name = \"PKG-INFO\"\n        try:\n            metadata = self.read_text(metadata_name)","sourceCodeStart":201,"sourceCodeEnd":237,"githubUrl":"https://github.com/pypa/pip/blob/f399c3718970b1b0e2478dac5296eb62679a9b86/src/pip/_internal/metadata/pkg_resources.py#L201-L237","documentation":"Raised as InstallationError from Distribution.iter_entry_points in pkg_resources.py:215-221. When pkg_resources' get_entry_map() raises ValueError parsing entry_points.txt (malformed entry), pip wraps it with the distribution's raw name so the offending package is identifiable — parallel to the importlib backend's handling.","triggerScenarios":"Accessing iter_entry_points() on a pkg_resources-backed Distribution whose entry_points.txt has a syntactically invalid entry; get_entry_map() raises ValueError, re-raised as InstallationError.","commonSituations":"A package with a hand-edited or buggy entry_points.txt; an old build that emitted malformed entry-point strings; tooling that rewrote entry_points.txt incorrectly.","solutions":["Reinstall the package from a version with valid entry_points.txt.","Fix the entry_points definition in the source and rebuild.","Remove the offending entry_points.txt if console scripts are not needed."],"exampleFix":"// before (entry_points.txt)\n[console_scripts]\nmycmd ;\n// after\n[console_scripts]\nmycmd = mypkg.cli:main","handlingStrategy":"try-catch","validationCode":"// Before iterating entry points, validate the entry_points.txt via configparser:\nep = dist._dist.get_metadata('entry_points.txt') if dist._dist.has_metadata('entry_points.txt') else None\nif ep:\n    cp = configparser.ConfigParser(); cp.read_string(ep)","typeGuard":null,"tryCatchPattern":"from pip._internal.exceptions import InstallationError\ntry:\n    list(dist.iter_entry_points())\nexcept InstallationError as e:\n    if 'Error parsing entry points' in str(e):\n        # reinstall or drop the package's entry_points.txt\n        ...","preventionTips":["Write entry_points.txt with valid 'name = module:attr' lines.","Validate entry-point definitions during the build.","Reinstall packages whose entry_points.txt is malformed."],"tags":["metadata","entry-points","pkg-resources","parsing"],"backgroundTag":null,"analyzedSha":"f399c3718970b1b0e2478dac5296eb62679a9b86","analyzedAt":"2026-08-08T23:01:42.227Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}