crewAIInc/crewAI · error · ValueError
Unsupported tar format: {format}
Error message
Unsupported tar format: {format} What it means
Raised by FileCompressorTool._compress_tar when the requested archive format is not one of 'tar', 'tar.gz', 'tar.bz2', 'tar.xz'. The method maps format strings to tarfile mode strings via a dict; a missing key means Python's tarfile has no configured writer for that compression and the tool refuses rather than guessing a default.
Source
Thrown at lib/crewai-tools/src/crewai_tools/tools/files_compressor_tool/files_compressor_tool.py:135
else:
for root, _, files in os.walk(input_path):
for file in files:
full_path = os.path.join(root, file)
arcname = os.path.relpath(full_path, start=input_path)
zipf.write(full_path, arcname)
@staticmethod
def _compress_tar(input_path: str, output_path: str, format: str) -> None:
"""Compresses input into a tar archive with the given format."""
format_mode = {
"tar": "w",
"tar.gz": "w:gz",
"tar.bz2": "w:bz2",
"tar.xz": "w:xz",
}
if format not in format_mode:
raise ValueError(f"Unsupported tar format: {format}")
mode = format_mode[format]
with tarfile.open(output_path, mode) as tarf: # type: ignore[call-overload]
arcname = os.path.basename(input_path)
tarf.add(input_path, arcname=arcname)
View on GitHub (pinned to 754d7323be)
Solutions
- Use exactly one of: 'tar', 'tar.gz', 'tar.bz2', 'tar.xz'.
- Normalize your format string before calling: fmt.lower() and expand aliases like 'tgz' -> 'tar.gz' yourself.
- For zip output, use the tool's zip path/compression option instead of the tar path.
Example fix
# before compress(input_path='out', output_path='a.tgz', format='tgz') # after compress(input_path='out', output_path='a.tar.gz', format='tar.gz')
Defensive patterns
Strategy: validation
Validate before calling
TAR_FORMATS = {'tar','tar.gz','tar.bz2','tar.xz'}
ALIASES = {'tgz':'tar.gz','tbz2':'tar.bz2','txz':'tar.xz'}
fmt = ALIASES.get(fmt.lower(), fmt.lower())
if fmt not in TAR_FORMATS:
raise ValueError(f'format must be one of {sorted(TAR_FORMATS)}') Type guard
def is_supported_tar_format(fmt: str) -> bool:
return fmt.lower() in {'tar','tar.gz','tar.bz2','tar.xz'} Prevention
- Normalize format aliases (tgz -> tar.gz) at your call site.
- Use the tool's zip option for zip archives rather than the tar path.
When it happens
Trigger: Calling the compressor with format='zip' (handled by a different code path only if the tool routes it there), format='tgz', format='tar.zst', or any variant spelling like 'tar.gzip' or 'TAR.GZ' (keys are case-sensitive).
Common situations: Users assuming any tarfile-supported compression works (tarfile also supports e.g. 'w:xz' only — zstd/lzma variants beyond the mapping do not); LLM agents shortening 'tar.gz' to 'tgz'; case or spelling drift between docs and the mapping keys.
Related errors
- Blocked unsupported tar member: {member.name!r}
- Project name '{name}' would generate folder name '{folder_na
- Project name '{name}' contains no valid characters for a Pyt
- Project name '{name}' would generate class name '{class_name
- Project name '{name}' would generate class name '{class_name
AI-assisted analysis of crewAIInc/crewAI@754d7323be (2026-08-15).
Data as JSON: /api/errors/760acce4866ea33c.
Report an issue: GitHub.