{"record":{"id":"1dc0168cc5b0c973","repo":"apache/beam","slug":"unknown-watch-growth-state-tag-r","errorCode":null,"errorMessage":"unknown Watch growth state tag: %r","messagePattern":"unknown Watch growth state tag: %r","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/io/watch.py","lineNumber":400,"sourceCode":"  def decode(self, encoded: bytes) -> _GrowthState:\n    tag, payload = self._envelope_coder.decode(encoded)\n    if tag == _StateTag.POLLING:\n      termination_state, poll_watermark, items = self._polling_coder.decode(\n          payload)\n      return _PollingGrowthState(\n          collections.OrderedDict(items), poll_watermark, termination_state)\n    if tag == _StateTag.NON_POLLING:\n      watermark, outputs = self._non_polling_coder.decode(payload)\n      return _NonPollingGrowthState(PollResult(tuple(outputs), watermark))\n    if tag == _StateTag.CURSOR_POLLING:\n      termination_state, poll_watermark, items, cursor = (\n          self._cursor_polling_coder.decode(payload))\n      return _PollingGrowthState(\n          collections.OrderedDict(items),\n          poll_watermark,\n          termination_state,\n          cursor)\n    raise ValueError('unknown Watch growth state tag: %r' % (tag, ))\n\n  def is_deterministic(self) -> bool:\n    return False\n\n\n# ------------------------------------------------------------------------------\n# Restriction tracker.\n# ------------------------------------------------------------------------------\n\n\ndef _identity(value: Any) -> Any:\n  return value\n\n\ndef _hash_output(key_coder: Coder, value: Any) -> bytes:\n  return hashlib.blake2b(\n      key_coder.encode(value), digest_size=_HASH_DIGEST_SIZE).digest()\n","sourceCodeStart":382,"sourceCodeEnd":418,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/io/watch.py#L382-L418","documentation":"_PollingGrowthStateCoder.decode reads a tag byte to determine which subclass of _GrowthState was encoded and reconstructs it. An unknown tag means the payload does not correspond to any known state encoding — either corrupt data, a cross-version encoding mismatch, or a bug in encode/decode pairing.","triggerScenarios":"Decoding Watch growth-state payloads produced by a different Beam version, decoding a manually corrupted/byte-modified payload, or a custom _GrowthState subclass whose coder writes a tag the decoder does not handle.","commonSituations":"Running pipelines across mixed Beam worker versions (runner-upgrade mid-job); hand-editing or reusing serialized coders; customizing Watch internals without updating both encode and decode paths.","solutions":["Ensure all workers and the pipeline submission use the same Apache Beam version","If you added a custom _GrowthState subclass, register its tag in decode and write it in encode","Inspect the payload/tag byte for corruption; re-run the pipeline to regenerate state"],"exampleFix":"// before\nclass MyStateCoder(_PollingGrowthStateCoder):\n  pass  # encode writes custom tag, decode never handles it\n// after\nclass MyStateCoder(_PollingGrowthStateCoder):\n  def encode(self, state):\n    ...  # write matching tag\n  def decode(self, payload):\n    tag = payload[0]\n    if tag == MY_TAG:\n      ...  # handle it before falling through\n    return super().decode(payload)","handlingStrategy":"validation","validationCode":"assert len(payload) > 0 and payload[0] in KNOWN_GROWTH_STATE_TAGS, 'bad growth-state tag'","typeGuard":null,"tryCatchPattern":"try:\n    state = coder.decode(payload)\nexcept ValueError as e:\n    log.error('growth state decode failed: %s', e)\n    raise","preventionTips":["Keep Beam versions identical across submission and all workers","Never hand-edit serialized state payloads","If extending _GrowthState, update encode and decode tag handling in lockstep"],"tags":["python","apache-beam","deserialization","coder","watch-io"],"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-14T16:17:12.679Z"}