{"record":{"id":"8b1a85d3805e75be","repo":"ytdl-org/youtube-dl","slug":"python-pyxattr-is-detected-but-is-too-old-youtube","errorCode":null,"errorMessage":"python-pyxattr is detected but is too old. youtube-dl requires %s or above while your version is %s. Falling back to other xattr implementations","messagePattern":"python-pyxattr is detected but is too old\\. youtube-dl requires (.+?) or above while your version is (.+?)\\. Falling back to other xattr implementations","errorType":"exception","errorClass":"XAttrUnavailableError","httpStatus":null,"severity":"warning","filePath":"youtube_dl/utils.py","lineNumber":6179,"sourceCode":"            current_row.append(color)\n\n    return width, height, pixels\n\n\ndef write_xattr(path, key, value):\n    # This mess below finds the best xattr tool for the job\n    try:\n        # try the pyxattr module...\n        import xattr\n\n        if hasattr(xattr, 'set'):  # pyxattr\n            # Unicode arguments are not supported in python-pyxattr until\n            # version 0.5.0\n            # See https://github.com/ytdl-org/youtube-dl/issues/5498\n            pyxattr_required_version = '0.5.0'\n            if version_tuple(xattr.__version__) < version_tuple(pyxattr_required_version):\n                # TODO: fallback to CLI tools\n                raise XAttrUnavailableError(\n                    'python-pyxattr is detected but is too old. '\n                    'youtube-dl requires %s or above while your version is %s. '\n                    'Falling back to other xattr implementations' % (\n                        pyxattr_required_version, xattr.__version__))\n\n            setxattr = xattr.set\n        else:  # xattr\n            setxattr = xattr.setxattr\n\n        try:\n            setxattr(path, key, value)\n        except EnvironmentError as e:\n            raise XAttrMetadataError(e.errno, e.strerror)\n\n    except ImportError:\n        if compat_os_name == 'nt':\n            # Write xattrs to NTFS Alternate Data Streams:\n            # http://en.wikipedia.org/wiki/NTFS#Alternate_data_streams_.28ADS.29","sourceCodeStart":6161,"sourceCodeEnd":6197,"githubUrl":"https://github.com/ytdl-org/youtube-dl/blob/956b8c585591b401a543e409accb163eeaaa1193/youtube_dl/utils.py#L6161-L6197","documentation":"Raised as XAttrUnavailableError by _xattr_set() in youtube_dl.utils when writing extended attributes (e.g. embedding metadata via --xattr-set-filesize). The 'xattr' import resolved to python-pyxattr (it has a .set attribute), but its __version__ is below 0.5.0, which is the first release supporting unicode arguments (issue #5498). youtube-dl refuses to use it rather than crash on unicode paths, and despite the message text the code raises instead of actually falling back (the TODO 'fallback to CLI tools' is unimplemented).","triggerScenarios":"Running with --xattr-set-filesize (or any code path calling write_xattr) on a machine where python-pyxattr < 0.5.0 is importable. version_tuple(xattr.__version__) < version_tuple('0.5.0') triggers the raise.","commonSituations":"Old distro-packaged pyxattr (pre-2014 versions) still installed; embedded/bundled python environments shipping a stale pyxattr; enabling xattr metadata on a NAS or container image with ancient packages.","solutions":["Upgrade python-pyxattr to >= 0.5.0 (pip install -U pyxattr).","Or uninstall pyxattr so youtube-dl can use the alternate 'xattr' module or the setfattr CLI tool.","Or install the GNU attr package / setfattr tool as an alternative backend.","If you do not need xattr metadata, drop --xattr-set-filesize."],"exampleFix":"# before: python-pyxattr 0.4.x installed\nyoutube-dl --xattr-set-filesize URL  # XAttrUnavailableError: python-pyxattr is detected but is too old...\n\n# after\npip install -U 'pyxattr>=0.5.0'\nyoutube-dl --xattr-set-filesize URL","handlingStrategy":"validation","validationCode":"def pyxattr_ok():\n    try:\n        import xattr\n    except ImportError:\n        return False\n    if hasattr(xattr, 'set'):\n        from youtube_dl.utils import version_tuple\n        return version_tuple(xattr.__version__) >= version_tuple('0.5.0')\n    return True  # alternate 'xattr' module\n\n# before --xattr-set-filesize: if not pyxattr_ok(): upgrade or disable the flag","typeGuard":null,"tryCatchPattern":"from youtube_dl.utils import write_xattr, XAttrUnavailableError\ntry:\n    write_xattr(path, key, value)\nexcept XAttrUnavailableError:\n    pass  # metadata is optional; log and continue","preventionTips":["Pin pyxattr>=0.5.0 in requirements when using --xattr-set-filesize.","Treat xattr metadata as optional: always catch XAttrUnavailableError and continue the download.","In provisioning scripts, uninstall stale distro pyxattr and pip-install a current version."],"tags":["xattr","metadata","environment","version-mismatch"],"backgroundTag":null,"analyzedSha":"956b8c585591b401a543e409accb163eeaaa1193","analyzedAt":"2026-08-14T18:59:47.863Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}