{"id":"f0556b833ae091fe","repo":"pypa/pip","slug":"invalid-egg-fragment","errorCode":"invalid-egg-fragment","errorMessage":"The '{fragment}' egg fragment is invalid","messagePattern":"The '(.+?)' egg fragment is invalid","errorType":"validation","errorClass":"InvalidEggFragment","httpStatus":null,"severity":"error","filePath":"src/pip/_internal/models/link.py","lineNumber":526,"sourceCode":"        return urllib.parse.urlunsplit((scheme, netloc, path, query, \"\"))\n\n    _egg_fragment_re = re.compile(r\"[#&]egg=([^&]*)\")\n\n    # Per PEP 508.\n    _project_name_re = re.compile(\n        r\"^([A-Z0-9]|[A-Z0-9][A-Z0-9._-]*[A-Z0-9])$\", re.IGNORECASE\n    )\n\n    def _egg_fragment(self) -> str | None:\n        match = self._egg_fragment_re.search(self._url)\n        if not match:\n            return None\n\n        # An egg fragment looks like a PEP 508 project name, along with\n        # an optional extras specifier. Anything else is invalid.\n        project_name = match.group(1)\n        if not self._project_name_re.match(project_name):\n            raise InvalidEggFragment(self, project_name)\n\n        return project_name\n\n    _subdirectory_fragment_re = re.compile(r\"[#&]subdirectory=([^&]*)\")\n\n    @property\n    def subdirectory_fragment(self) -> str | None:\n        match = self._subdirectory_fragment_re.search(self._url)\n        if not match:\n            return None\n        return match.group(1)\n\n    def metadata_link(self) -> Link | None:\n        \"\"\"Return a link to the associated core metadata file (if any).\"\"\"\n        if self.metadata_file_data is None:\n            return None\n        metadata_url = f\"{self.url_without_fragment}.metadata\"\n        if self.metadata_file_data.hashes is None:","sourceCodeStart":508,"sourceCodeEnd":544,"githubUrl":"https://github.com/pypa/pip/blob/d7d0d0a39494e28ec1c407bd0680e4a4d1067791/src/pip/_internal/models/link.py#L508-L544","documentation":"Error \"The '{fragment}' egg fragment is invalid\" thrown in pypa/pip.","triggerScenarios":"Thrown at src/pip/_internal/models/link.py:526 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"d7d0d0a39494e28ec1c407bd0680e4a4d1067791","analyzedAt":"2026-08-04T20:55:04.259Z","schemaVersion":2}