{"record":{"id":"73c68e5284bf094a","repo":"apache/beam","slug":"bundle-processing-associated-with-s-has-failed-check-prior","errorCode":null,"errorMessage":"Bundle processing associated with %s has failed. Check prior failing response and attached exception for details.","messagePattern":"Bundle processing associated with (.+?) has failed\\. Check prior failing response and attached exception for details\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/runners/worker/sdk_worker.py","lineNumber":542,"sourceCode":"      except KeyError:\n        # The instruction may have not been pre-registered before execution\n        # since activate() may have never been invoked\n        pass\n    return processor\n\n  def lookup(self, instruction_id):\n    # type: (str) -> Optional[bundle_processor.BundleProcessor]\n\n    \"\"\"\n    Return the requested ``BundleProcessor`` from the cache.\n\n    Will return ``None`` if the BundleProcessor is known but not yet ready. Will\n    raise an error if the ``instruction_id`` is not known or has been discarded.\n    \"\"\"\n    with self._lock:\n      if instruction_id in self.failed_instruction_ids:\n        e = self.failed_instruction_ids[instruction_id]\n        raise RuntimeError(\n            'Bundle processing associated with %s has failed. '\n            'Check prior failing response and attached exception for details.' %\n            instruction_id) from e\n      processor = self.active_bundle_processors.get(\n          instruction_id, (None, None))[-1]\n      if processor:\n        return processor\n      if instruction_id in self.known_not_running_instruction_ids:\n        return None\n      raise RuntimeError('Unknown process bundle id %s.' % instruction_id)\n\n  def discard(self, instruction_id, exception):\n    # type: (str, Exception) -> None\n\n    \"\"\"\n    Marks the instruction id as failed shutting down the ``BundleProcessor``.\n    \"\"\"\n    processor = None","sourceCodeStart":524,"sourceCodeEnd":560,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/runners/worker/sdk_worker.py#L524-L560","documentation":" BundleProcessorCache.lookup raises this when the requested instruction_id is recorded in failed_instruction_ids. The prior failure's exception is attached via 'from', so the original error is available as __cause__. The cache deliberately turns previously failed bundle lookups into loud errors rather than silent restarts.","triggerScenarios":" Any call to lookup(instruction_id) (e.g. from process_bundle or monitoring handlers) after the bundle previously threw and was discarded via discard(instruction_id, exception).","commonSituations":" A bundle fails mid-processing (user code exception, resource issue) and a subsequent control request (e.g. progress or finalize) references the same already-failed instruction; duplicate/late control messages after a failure.","solutions":["Inspect the chained cause (__cause__) of this error — it holds the original bundle failure; fix that root problem.","Check worker logs immediately before this error for the first failing response/exception of the bundle.","Fix the failing DoFn/data issue so the bundle does not fail in the first place.","Ensure the runner does not re-send control requests for a failed instruction id."],"exampleFix":"# before\ntry:\n    process_bundle(instruction_id)\nexcept RuntimeError as e:\n    print(e)  # only the wrapper message\n\n# after\ntry:\n    process_bundle(instruction_id)\nexcept RuntimeError as e:\n    print(e)\n    if e.__cause__:\n        raise e.__cause__  # surface the original bundle failure","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    processor = cache.lookup(instruction_id)\nexcept RuntimeError as e:\n    root = e.__cause__\n    log.error('bundle %s failed earlier', instruction_id)\n    if root:\n        raise root  # fix the original failure, not the wrapper\n    raise","preventionTips":["Always inspect e.__cause__ to find the real bundle failure.","Fix the first exception in the worker logs before retrying.","Do not send further control requests for failed instruction ids."],"tags":["apache-beam","sdk-worker","bundle-failure"],"backgroundTag":"invalid-state-transition","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"}