{"record":{"id":"c4243d1ac04db147","repo":"apache/beam","slug":"dependency-computation-failed-or-was-cancelled","errorCode":null,"errorMessage":"Dependency computation failed or was cancelled.","messagePattern":"Dependency computation failed or was cancelled\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/runners/interactive/recording_manager.py","lineNumber":510,"sourceCode":"    if async_result:\n      async_result.set_pipeline_result(pipeline_result)\n\n    pipeline_result.wait_until_finish()\n    return pipeline_result\n\n  def _run_async_computation(\n      self,\n      pcolls_to_compute: set[beam.pvalue.PCollection],\n      async_result: 'AsyncComputationResult',\n      wait_for_inputs: bool,\n      runner: runner.PipelineRunner = None,\n      options: pipeline_options.PipelineOptions = None,\n  ):\n    \"\"\"The function to be run in the thread pool for async computation.\"\"\"\n    try:\n      if wait_for_inputs:\n        if not self._wait_for_dependencies(pcolls_to_compute, async_result):\n          raise RuntimeError('Dependency computation failed or was cancelled.')\n\n      _LOGGER.info(\n          'Starting asynchronous computation for %d PCollections.',\n          len(pcolls_to_compute))\n\n      pipeline_result = self._execute_pipeline_fragment(\n          pcolls_to_compute, async_result, runner, options)\n\n      return pipeline_result\n    except Exception as e:\n      _LOGGER.exception('Exception during asynchronous computation: %s', e)\n      raise\n\n  def _watch(self, pcolls: list[beam.pvalue.PCollection]) -> None:\n    \"\"\"Watch any pcollections not being watched.\n\n    This allows for the underlying caching layer to identify the PCollection as\n    something to be cached.","sourceCodeStart":492,"sourceCodeEnd":528,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/runners/interactive/recording_manager.py#L492-L528","documentation":"In the background thread run by _run_async_computation, if wait_for_inputs is set and _wait_for_dependencies reports that a dependency PCollection's async computation failed or was cancelled, a RuntimeError is raised so the current computation is marked failed rather than computing on missing inputs.","triggerScenarios":"Computing a PCollection asynchronously whose upstream PCollection was itself computed asynchronously and failed/cancelled; chained ib.collect calls where an earlier async compute did not reach a DONE state.","commonSituations":"Multi-step interactive pipelines in notebooks where a downstream collect depends on an upstream computation that hit a pipeline error, was cancelled, or exceeded its timeout.","solutions":["Re-run the upstream computation first and confirm it succeeds before computing the dependent PCollection","Inspect logs for the original failure of the dependency (the root pipeline error is logged by the manager)","Cancel and restart the interactive environment (ib.options) if stale computation state persists","Reduce chain depth: compute dependencies with blocking mode to surface errors immediately"],"exampleFix":"// before\nib.collect(downstream_pcoll)  # fails because upstream async compute failed\n// after\nib.collect(upstream_pcoll)   # ensure the dependency computes successfully first\nib.collect(downstream_pcoll)","handlingStrategy":"try-catch","validationCode":"from apache_beam.runners.interactive import interactive_environment as ie\nenv = ie.current_env()\nif any(not env.is_pcollection_computed(p) for p in upstream_pcolls):\n    compute_upstreams_first()","typeGuard":null,"tryCatchPattern":"try:\n    ib.collect(downstream_pcoll)\nexcept RuntimeError as e:\n    if 'Dependency computation failed' in str(e):\n        ib.collect(upstream_pcoll)  # recompute dependency, then retry","preventionTips":["Compute PCollections in topological order (upstream first)","Confirm each upstream ib.collect succeeded before dependent collects","Use blocking computes for dependencies to surface errors early","Keep the interactive environment consistent; restart after repeated failures"],"tags":["async","dependencies","interactive-beam"],"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"}