{"record":{"id":"760acce4866ea33c","repo":"crewAIInc/crewAI","slug":"unsupported-tar-format-format","errorCode":null,"errorMessage":"Unsupported tar format: {format}","messagePattern":"Unsupported tar format: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"lib/crewai-tools/src/crewai_tools/tools/files_compressor_tool/files_compressor_tool.py","lineNumber":135,"sourceCode":"            else:\n                for root, _, files in os.walk(input_path):\n                    for file in files:\n                        full_path = os.path.join(root, file)\n                        arcname = os.path.relpath(full_path, start=input_path)\n                        zipf.write(full_path, arcname)\n\n    @staticmethod\n    def _compress_tar(input_path: str, output_path: str, format: str) -> None:\n        \"\"\"Compresses input into a tar archive with the given format.\"\"\"\n        format_mode = {\n            \"tar\": \"w\",\n            \"tar.gz\": \"w:gz\",\n            \"tar.bz2\": \"w:bz2\",\n            \"tar.xz\": \"w:xz\",\n        }\n\n        if format not in format_mode:\n            raise ValueError(f\"Unsupported tar format: {format}\")\n\n        mode = format_mode[format]\n\n        with tarfile.open(output_path, mode) as tarf:  # type: ignore[call-overload]\n            arcname = os.path.basename(input_path)\n            tarf.add(input_path, arcname=arcname)\n","sourceCodeStart":117,"sourceCodeEnd":142,"githubUrl":"https://github.com/crewAIInc/crewAI/blob/754d7323beb2fd042e33444a115ea2d5a47193f0/lib/crewai-tools/src/crewai_tools/tools/files_compressor_tool/files_compressor_tool.py#L117-L142","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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."],"exampleFix":"# before\ncompress(input_path='out', output_path='a.tgz', format='tgz')\n\n# after\ncompress(input_path='out', output_path='a.tar.gz', format='tar.gz')","handlingStrategy":"validation","validationCode":"TAR_FORMATS = {'tar','tar.gz','tar.bz2','tar.xz'}\nALIASES = {'tgz':'tar.gz','tbz2':'tar.bz2','txz':'tar.xz'}\nfmt = ALIASES.get(fmt.lower(), fmt.lower())\nif fmt not in TAR_FORMATS:\n    raise ValueError(f'format must be one of {sorted(TAR_FORMATS)}')","typeGuard":"def is_supported_tar_format(fmt: str) -> bool:\n    return fmt.lower() in {'tar','tar.gz','tar.bz2','tar.xz'}","tryCatchPattern":null,"preventionTips":["Normalize format aliases (tgz -> tar.gz) at your call site.","Use the tool's zip option for zip archives rather than the tar path."],"tags":["compression","tar","validation","file-tools"],"backgroundTag":null,"analyzedSha":"754d7323beb2fd042e33444a115ea2d5a47193f0","analyzedAt":"2026-08-15T04:06:56.746Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}