{"record":{"id":"99cbbef76f461d7b","repo":"apache/beam","slug":"unable-to-handle-state-requests-for-processbundledescriptor-99cbbe","errorCode":null,"errorMessage":"Unable to handle state requests for ProcessBundleDescriptor.","messagePattern":"Unable to handle state requests for ProcessBundleDescriptor\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/runners/worker/sdk_worker.py","lineNumber":1036,"sourceCode":"      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 '\n        'state ApiServiceDescriptor for state key %s.' % state_key)\n\n  def done(self):\n    # type: () -> None\n    raise RuntimeError(\n        'Unable to handle state requests for ProcessBundleDescriptor.')\n\n\nclass GrpcStateHandler(StateHandler):\n\n  _DONE = Sentinel.sentinel\n\n  def __init__(self, state_stub):\n    # type: (beam_fn_api_pb2_grpc.BeamFnStateStub) -> None\n    self._lock = threading.Lock()\n    self._state_stub = state_stub\n    self._requests = queue.Queue(\n    )  # type: queue.Queue[Union[beam_fn_api_pb2.StateRequest, Sentinel]]\n    self._responses_by_id = {}  # type: Dict[str, _Future]\n    self._last_id = 0\n    self._exception = None  # type: Optional[Exception]\n    self._context = threading.local()\n    self.start()","sourceCodeStart":1018,"sourceCodeEnd":1054,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/runners/worker/sdk_worker.py#L1018-L1054","documentation":"ThrowingStateHandler.done always raises as a final guard: any lifecycle completion of state handling proves state requests were attempted against a descriptor without a state service. It fires when the harness finalizes state handling for a bundle.","triggerScenarios":"Calling done() on ThrowingStateHandler at bundle teardown after any state-enabled bundle was processed with this stub handler.","commonSituations":"Same as sibling errors: stateful pipelines executed on harnesses lacking state ApiServiceDescriptor configuration.","solutions":["Replace ThrowingStateHandler with GrpcStateHandler/CachingStateHandler at harness construction","Remove stateful stages from the pipeline or use a runner that supports state","Verify worker startup flags pass the state ApiServiceDescriptor"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"assert state_api_service_descriptor is not None, 'descriptor missing state service'","typeGuard":null,"tryCatchPattern":"try:\n  handler.done()\nexcept RuntimeError as e:\n  log.error('state handler teardown failed: %s', e)\n  raise","preventionTips":["Ensure harness construction always binds a functional state handler","Add health checks that call done() only in real state handlers"],"tags":["apache-beam","state-handler","lifecycle"],"backgroundTag":"internal-invariant-violation","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"}