{"record":{"id":"d66b32a1af96cf72","repo":"apache/beam","slug":"unsupported-cache-format-s","errorCode":null,"errorMessage":"Unsupported cache format: '%s'.","messagePattern":"Unsupported cache format: '(.+?)'\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/runners/interactive/cache_manager.py","lineNumber":182,"sourceCode":"          lambda path: textio.ReadFromText(\n              path, coder=Base64Coder(), compression_type=filesystems.\n              CompressionTypes.BZIP2), lambda path: textio.WriteToText(\n                  path, coder=Base64Coder(), compression_type=filesystems.\n                  CompressionTypes.BZIP2)),\n      'tfrecord': (tfrecordio.ReadFromTFRecord, tfrecordio.WriteToTFRecord)\n  }\n\n  def __init__(self, cache_dir=None, cache_format='text'):\n    if cache_dir:\n      self._cache_dir = cache_dir\n    else:\n      self._cache_dir = tempfile.mkdtemp(\n          prefix='ib-', dir=os.environ.get('TEST_TMPDIR', None))\n    self._versions = collections.defaultdict(lambda: self._CacheVersion())\n    self.cache_format = cache_format\n\n    if cache_format not in self._available_formats:\n      raise ValueError(\"Unsupported cache format: '%s'.\" % cache_format)\n    self._reader_class, self._writer_class = self._available_formats[\n        cache_format]\n    self._default_pcoder = (\n        SafeFastPrimitivesCoder() if cache_format == 'text' else None)\n\n    # List of saved pcoders keyed by PCollection path. It is OK to keep this\n    # list in memory because once FileBasedCacheManager object is\n    # destroyed/re-created it loses the access to previously written cache\n    # objects anyways even if cache_dir already exists. In other words,\n    # it is not possible to resume execution of Beam pipeline from the\n    # saved cache if FileBasedCacheManager has been reset.\n    #\n    # However, if we are to implement better cache persistence, one needs\n    # to take care of keeping consistency between the cached PCollection\n    # and its PCoder type.\n    self._saved_pcoders = {}\n\n  def size(self, *labels):","sourceCodeStart":164,"sourceCodeEnd":200,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/runners/interactive/cache_manager.py#L164-L200","documentation":"The RecordingCacheManager constructor validates the cache_format argument against the set of supported formats ('batch'/'text' style map in _available_formats). An unknown format string raises ValueError before reader/writer classes are selected.","triggerScenarios":"Creating RecordingCacheManager(cache_dir, cache_format='parquet' or any unsupported string); passing a misspelled format like 'textt' or 'json'; constructing the manager programmatically instead of via the default.","commonSituations":"Custom interactive cache setups copying old code that used formats since removed; typos when overriding the default cache format; version drift where a format was dropped from _available_formats.","solutions":["Pass one of the supported formats exactly as listed in cache_manager._available_formats (e.g. 'text' or the default 'batch').","Fix typos in the cache_format string.","Omit the argument to use the default format.","Check the installed apache-beam version's cache_manager.py if migrating code across versions, since supported formats changed."],"exampleFix":"// before\ncm = RecordingCacheManager(cache_dir, cache_format='json')\n// after\ncm = RecordingCacheManager(cache_dir, cache_format='text')","handlingStrategy":"validation","validationCode":"from apache_beam.runners.interactive import cache_manager\nfmt = 'json'\nif fmt not in cache_manager.RecordingCacheManager._available_formats:\n    fmt = next(iter(cache_manager.RecordingCacheManager._available_formats))\ncm = cache_manager.RecordingCacheManager(cache_dir, cache_format=fmt)","typeGuard":"def valid_cache_format(fmt, mgr_cls):\n    return fmt in mgr_cls._available_formats","tryCatchPattern":"try:\n    cm = RecordingCacheManager(cache_dir, cache_format=fmt)\nexcept ValueError as e:\n    if 'Unsupported cache format' in str(e):\n        cm = RecordingCacheManager(cache_dir)  # default format","preventionTips":["Always derive allowed formats from _available_formats rather than hardcoding.","Pin the apache-beam version in environments that construct cache managers directly."],"tags":["apache-beam","interactive-beam","cache","invalid-value"],"backgroundTag":"invalid-enum-value","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}