{"record":{"id":"fb59452fc34649a4","repo":"apache/beam","slug":"cannot-record-because-a-dependency-failed-to-compute","errorCode":null,"errorMessage":"Cannot record because a dependency failed to compute asynchronously.","messagePattern":"Cannot record because a dependency failed to compute asynchronously\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/runners/interactive/recording_manager.py","lineNumber":918,"sourceCode":"\n    # Make sure that all PCollections to be shown are watched. If a PCollection\n    # has not been watched, make up a variable name for that PCollection and\n    # watch it. No validation is needed here because the watch logic can handle\n    # arbitrary variables.\n    self._watch(pcolls)\n    self.record_pipeline()\n\n    # Early check and return if everything is already computed\n    uncomputed_pcolls = self._get_uncomputed_pcolls(pcolls)\n    if not uncomputed_pcolls:\n      recording = Recording(\n          self.user_pipeline, pcolls, None, max_n, max_duration_secs)\n      self._recordings.add(recording)\n      return recording\n\n    # Wait for dependencies if there are uncomputed PCollections\n    if not self._wait_for_dependencies(uncomputed_pcolls):\n      raise RuntimeError(\n          'Cannot record because a dependency failed to compute'\n          ' asynchronously.')\n\n    # Re-evaluate uncomputed PCollections\n    uncomputed_pcolls = self._get_uncomputed_pcolls(pcolls)\n    if not uncomputed_pcolls:\n      recording = Recording(\n          self.user_pipeline, pcolls, None, max_n, max_duration_secs)\n      self._recordings.add(recording)\n      return recording\n\n    # Flattened execution path (no indentation needed)\n    self._clear()\n\n    merged_options = pipeline_options.PipelineOptions(\n        **{\n            **self.user_pipeline.options.get_all_options(\n                drop_default=True, retain_unknown_options=True),","sourceCodeStart":900,"sourceCodeEnd":936,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/runners/interactive/recording_manager.py#L900-L936","documentation":"Recording.record requires all dependency PCollections to be computed before recording starts; if _wait_for_dependencies returns False after waiting on uncomputed inputs, it raises this RuntimeError rather than recording from a pipeline whose inputs never materialized.","triggerScenarios":"Calling ib.recordings.record (or watch) with PCollections that depend on uncomputed upstreams whose async computation failed or was cancelled.","commonSituations":"Notebooks setting up recordings on pipelines whose upstream ib.collect previously failed; recordings created immediately after an interrupted computation.","solutions":["Compute the upstream PCollections successfully (ib.collect) before starting the recording","Inspect why the dependency computation failed (runner logs) and fix the root cause","Restart the interactive environment to clear stale failed-computation state","Record only PCollections whose full lineage has already been computed"],"exampleFix":"// before\nrecording = ib.recordings.record([downstream_pcoll], max_n=100)\n// after\nib.collect(upstream_pcoll)  # ensure dependencies are computed\nrecording = ib.recordings.record([downstream_pcoll], max_n=100)","handlingStrategy":"validation","validationCode":"env = ie.current_env()\nuncomputed = [p for p in pcolls if not env.is_pcollection_computed(p)]\nif uncomputed:\n    for p in upstream_of(uncomputed):\n        ib.collect(p)  # compute dependencies before recording","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always compute full upstream lineage before creating a recording","Check ib.recordings / environment computed flags before record()","Fix failed upstream computations rather than retrying the recording directly","Restart the interactive environment if dependency state is stale"],"tags":["dependencies","recording","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"}