{"record":{"id":"feebd99e96465207","repo":"pypa/pip","slug":"unknown-scheme-key-used-in-wheel-path-scheme-k","errorCode":null,"errorMessage":"Unknown scheme key used in {wheel_path}: {scheme_key} (for file {record_path!r}). .data directory contents should be in subdirectories named with a valid scheme key ({valid_scheme_keys})","messagePattern":"Unknown scheme key used in (.+?): (.+?) \\(for file (.+?)\\)\\. \\.data directory contents should be in subdirectories named with a valid scheme key \\((.+?)\\)","errorType":"exception","errorClass":"InstallationError","httpStatus":null,"severity":"error","filePath":"src/pip/_internal/operations/install/wheel.py","lineNumber":542,"sourceCode":"                _, scheme_key, dest_subpath = normed_path.split(os.path.sep, 2)\n            except ValueError:\n                message = (\n                    f\"Unexpected file in {wheel_path}: {record_path!r}. .data directory\"\n                    \" contents should be named like: '<scheme key>/<path>'.\"\n                )\n                raise InstallationError(message)\n\n            try:\n                scheme_path = scheme_paths[scheme_key]\n            except KeyError:\n                valid_scheme_keys = \", \".join(sorted(scheme_paths))\n                message = (\n                    f\"Unknown scheme key used in {wheel_path}: {scheme_key} \"\n                    f\"(for file {record_path!r}). .data directory contents \"\n                    f\"should be in subdirectories named with a valid scheme \"\n                    f\"key ({valid_scheme_keys})\"\n                )\n                raise InstallationError(message)\n\n            dest_path = os.path.join(scheme_path, dest_subpath)\n            assert_no_path_traversal(scheme_path, dest_path)\n            return ZipBackedFile(record_path, dest_path, zip_file)\n\n        return make_data_scheme_file\n\n    def is_data_scheme_path(path: RecordPath) -> bool:\n        return path.split(\"/\", 1)[0].endswith(\".data\")\n\n    paths = cast(list[RecordPath], wheel_zip.namelist())\n    file_paths = filterfalse(is_dir_path, paths)\n    root_scheme_paths, data_scheme_paths = partition(is_data_scheme_path, file_paths)\n\n    make_root_scheme_file = root_scheme_file_maker(wheel_zip, lib_dir)\n    files: Iterator[File] = map(make_root_scheme_file, root_scheme_paths)\n\n    def is_script_scheme_path(path: RecordPath) -> bool:","sourceCodeStart":524,"sourceCodeEnd":560,"githubUrl":"https://github.com/pypa/pip/blob/f399c3718970b1b0e2478dac5296eb62679a9b86/src/pip/_internal/operations/install/wheel.py#L524-L560","documentation":"Raised as InstallationError by make_data_scheme_file when the .data subdirectory name (scheme_key) is not one of the recognised scheme keys (purelib, platlib, headers, scripts, data). Because the key maps to no install location, pip cannot place the file and aborts.","triggerScenarios":"The wheel contains 'pkg-1.0.data/<unknownkey>/file'; scheme_paths[scheme_key] raises KeyError, and the valid keys are listed in the error message.","commonSituations":"A future/new scheme key this pip version does not recognise; a wheel built by a buggy backend that invented a key; typos in hand-made wheels.","solutions":["Upgrade pip to a version that recognises the scheme key if it is legitimately new.","Rebuild the wheel using a standard build backend so it only emits valid scheme keys.","Inspect the wheel's .data subdirs and correct any invalid key."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"VALID_SCHEME_KEYS = {\"purelib\", \"platlib\", \"headers\", \"scripts\", \"data\"}\n\ndef data_scheme_key_valid(record_path: str) -> bool:\n    parts = record_path.split(\"/\")\n    if len(parts) < 3 or not parts[0].endswith(\".data\"):\n        return True  # not a data-scheme path\n    return parts[1] in VALID_SCHEME_KEYS\n\n# assert data_scheme_key_valid(\"pkg-1.0.data/scripts/x\")\n# assert not data_scheme_key_valid(\"pkg-1.0.data/wrongkey/x\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Upgrade pip to a version supporting the scheme keys your wheels use.","Build wheels with standard backends so only valid scheme keys are emitted.","Audit .data subdirectory names in any hand-built wheels."],"tags":["packaging","wheel","scheme","data-directory"],"backgroundTag":null,"analyzedSha":"f399c3718970b1b0e2478dac5296eb62679a9b86","analyzedAt":"2026-08-08T23:01:42.227Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}