Python 3.9+tarfileexception
tarfile.LinkFallbackError
exceptions
The filter exception for a link that cannot be emulated by copying another member, because the filter would refuse that member.
Syntax
except tarfile.LinkFallbackError as e: e.__context__
Where a link cannot be created (say, no symlink permission on Windows), tarfile substitutes a copy of the target member. If that target would itself fail the filter at the new location, extraction refuses with this exception, and the original reason is in __context__. It came with the June 2025 security fixes in several branches at once — 3.9.23, 3.10.18, 3.11.13, 3.12.11 and 3.13.4 — and 3.14 has it from the first release; earlier releases of those branches lack it, so check hasattr before relying on it.
Examples
import tarfile
print(issubclass(tarfile.LinkFallbackError, tarfile.FilterError)) # → True
err = tarfile.LinkFallbackError(tarfile.TarInfo('link'), 'out/link')
print(err.tarinfo.name) # → link
See also
Common errors
Open in the full glossarydocs.python.orgReport an inaccuracy