{"id":"496ea7c631c8992e","repo":"pypa/pip","slug":"requested-ireq-has-inconsistent-provides-extra-b","errorCode":null,"errorMessage":"Requested {ireq} has inconsistent Provides-Extra between its PEP 658 .metadata file and the wheel's METADATA: sidecar has {f_val!r}, wheel has {m_val!r}","messagePattern":"Requested (.+?) has inconsistent Provides-Extra between its PEP 658 \\.metadata file and the wheel's METADATA: sidecar has (.+?), wheel has (.+?)","errorType":"exception","errorClass":"SidecarMetadataInconsistent","httpStatus":null,"severity":"error","filePath":"src/pip/_internal/operations/prepare.py","lineNumber":334,"sourceCode":"        raise SidecarMetadataInconsistent(\n            req,\n            \"Requires-Dist\",\n            \", \".join(sorted(sidecar_requires - wheel_requires)),\n            \", \".join(sorted(wheel_requires - sidecar_requires)),\n        )\n\n    if sidecar_dist.requires_python != wheel_dist.requires_python:\n        raise SidecarMetadataInconsistent(\n            req,\n            \"Requires-Python\",\n            str(sidecar_dist.requires_python),\n            str(wheel_dist.requires_python),\n        )\n\n    sidecar_extras = frozenset(sidecar_dist.iter_provided_extras())\n    wheel_extras = frozenset(wheel_dist.iter_provided_extras())\n    if sidecar_extras != wheel_extras:\n        raise SidecarMetadataInconsistent(\n            req,\n            \"Provides-Extra\",\n            \", \".join(sorted(sidecar_extras - wheel_extras)),\n            \", \".join(sorted(wheel_extras - sidecar_extras)),\n        )\n\n\nclass RequirementPreparer:\n    \"\"\"Prepares a Requirement\"\"\"\n\n    def __init__(\n        self,\n        *,\n        build_dir: str,\n        download_dir: str | None,\n        src_dir: str,\n        build_isolation: BuildIsolationMode,\n        build_isolation_installer: BuildEnvironmentInstaller,","sourceCodeStart":316,"sourceCodeEnd":352,"githubUrl":"https://github.com/pypa/pip/blob/d7d0d0a39494e28ec1c407bd0680e4a4d1067791/src/pip/_internal/operations/prepare.py#L316-L352","documentation":"Raised as SidecarMetadataInconsistent for Provides-Extra when the set of declared extras in the PEP 658 .metadata sidecar differs from the wheel's METADATA. At prepare.py:331-339 both sides are turned into frozensets via iter_provided_extras(); the message reports extras present on one side but not the other.","triggerScenarios":"The sidecar advertises a different set of extras (e.g. 'test', 'docs') than the wheel's METADATA. Triggered in _check_sidecar_matches_wheel after a remote wheel is fully downloaded.","commonSituations":"A release added/removed an extra but the index's .metadata sidecar is stale. Mirror/CDN desync. Re-published wheel with changed extras.","solutions":["Clear pip and HTTP caches: pip cache purge, then retry.","Install from the official index with the exact version pinned to avoid stale sidecar data.","Avoid requesting the extra that is inconsistent, or use a version known to declare it consistently: pip install 'pkg==<ver>[extra]'.","Report to the index operator to regenerate .metadata files on wheel changes."],"exampleFix":"# before: sidecar has no 'docs' extra, wheel METADATA does\npip install 'pkg[docs]'  # -> SidecarMetadataInconsistent Provides-Extra\n\n# after: use official index, exact version\npip install --index-url https://pypi.org/simple/ 'pkg==1.0.0[docs]'","handlingStrategy":"validation","validationCode":"def extras_match(sidecar_extras, wheel_extras) -> bool:\n    return frozenset(sidecar_extras) == frozenset(wheel_extras)\n\nif not extras_match(sidecar.iter_provided_extras(), wheel.iter_provided_extras()):\n    logger.warning(\"extras differ between sidecar and wheel\")","typeGuard":"def extras_match(sidecar: list[str], wheel: list[str]) -> bool:\n    return frozenset(sidecar) == frozenset(wheel)","tryCatchPattern":null,"preventionTips":["Pin exact versions and extras from a trusted index.","Regenerate .metadata files whenever the extras set changes.","Purge caches when consistency errors first appear."],"tags":["metadata","pep658","sidecar","extras","packaging"],"analyzedSha":"d7d0d0a39494e28ec1c407bd0680e4a4d1067791","analyzedAt":"2026-08-04T20:55:04.259Z","schemaVersion":2}