{"record":{"id":"85c51691340af47b","repo":"apache/beam","slug":"unable-to-handle-state-requests-for-processbundledescriptor-85c516","errorCode":null,"errorMessage":"Unable to handle state requests for ProcessBundleDescriptor without state ApiServiceDescriptor for state key %s.","messagePattern":"Unable to handle state requests for ProcessBundleDescriptor without state ApiServiceDescriptor for state key (.+?)\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/runners/worker/sdk_worker.py","lineNumber":1013,"sourceCode":"    raise NotImplementedError(type(self))\n\n\nclass ThrowingStateHandler(CachingStateHandler):\n  \"\"\"A caching state handler that errors on any requests.\"\"\"\n  @contextlib.contextmanager\n  def process_instruction_id(self, bundle_id, cache_tokens):\n    # type: (str, Iterable[beam_fn_api_pb2.ProcessBundleRequest.CacheToken]) -> Iterator[None]\n    raise RuntimeError(\n        'Unable to handle state requests for ProcessBundleDescriptor '\n        'for bundle id %s.' % bundle_id)\n\n  def blocking_get(\n      self,\n      state_key,  # type: beam_fn_api_pb2.StateKey\n      coder,  # type: coder_impl.CoderImpl\n  ):\n    # type: (...) -> Iterable[Any]\n    raise RuntimeError(\n        'Unable to handle state requests for ProcessBundleDescriptor without '\n        'state ApiServiceDescriptor for state key %s.' % state_key)\n\n  def extend(\n      self,\n      state_key,  # type: beam_fn_api_pb2.StateKey\n      coder,  # type: coder_impl.CoderImpl\n      elements,  # type: Iterable[Any]\n  ):\n    # type: (...) -> _Future\n    raise RuntimeError(\n        'Unable to handle state requests for ProcessBundleDescriptor without '\n        'state ApiServiceDescriptor for state key %s.' % state_key)\n\n  def clear(self, state_key):\n    # type: (beam_fn_api_pb2.StateKey) -> _Future\n    raise RuntimeError(\n        'Unable to handle state requests for ProcessBundleDescriptor without '","sourceCodeStart":995,"sourceCodeEnd":1031,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/runners/worker/sdk_worker.py#L995-L1031","documentation":"ThrowingStateHandler.blocking_get always raises: it is a placeholder for a state handler serving a ProcessBundleDescriptor that has no state ApiServiceDescriptor, so blocking state reads cannot be served. Throwing immediately surfaces the misconfiguration instead of hanging or silently returning wrong data.","triggerScenarios":"Calling blocking_get(state_key, coder) on a ThrowingStateHandler, which happens when pipeline code reads user state (ReadMaterializedState / ReadModifyWriteState) during bundle execution.","commonSituations":"Stateful streaming pipelines deployed on a runner whose worker harness was started without state API support; tests exercising bundle execution paths without a state service.","solutions":["Wire a functional GrpcStateHandler to the descriptor's state_api_service_descriptor","Refactor the DoFn to avoid state API reads (e.g. side inputs or pass-through data)","Update the runner/harness so the descriptor includes a state ApiServiceDescriptor"],"exampleFix":"// before\nhandler = ThrowingStateHandler()\nvalue = list(handler.blocking_get(state_key, coder))\n// after\nhandler = GrpcStateHandler(state_descriptor.state_api_service_descriptor)\nvalue = list(handler.blocking_get(state_key, coder))","handlingStrategy":"try-catch","validationCode":"if descriptor.state_api_service_descriptor is None: raise ConfigError('state requested but no state ApiServiceDescriptor')","typeGuard":null,"tryCatchPattern":"try:\n  value = handler.blocking_get(state_key, coder)\nexcept RuntimeError as e:\n  log.error('state reads unsupported: %s', e)\n  raise","preventionTips":["Validate descriptors declare a state ApiServiceDescriptor before processing stateful stages","Avoid beam.state transforms on runners without state support","Cover stateful DoFns with integration tests against a real state service"],"tags":["apache-beam","state-handler","user-state"],"backgroundTag":"unsupported-operation","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"}