{"record":{"id":"3be9637fc08aa217","repo":"apache/beam","slug":"this-pipeline-contains-a-dillcoder-which-requires-the-dill","errorCode":null,"errorMessage":"This pipeline contains a DillCoder which requires the dill package. Install the dill package with the dill extra e.g. apache-beam[dill]","messagePattern":"This pipeline contains a DillCoder which requires the dill package\\. Install the dill package with the dill extra e\\.g\\. apache-beam\\[dill\\]","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/coders/coders.py","lineNumber":927,"sourceCode":"  \"\"\"Coder using Python's pickle functionality.\"\"\"\n  def _create_impl(self):\n    dumps = pickle.dumps\n    protocol = pickle.HIGHEST_PROTOCOL\n    return coder_impl.CallbackCoderImpl(\n        lambda x: dumps(x, protocol), pickle.loads)\n\n  def as_deterministic_coder(self, step_label, error_message=None):\n    return FastPrimitivesCoder(self, requires_deterministic=step_label)\n\n  def to_type_hint(self):\n    return Any\n\n\nclass DillCoder(_PickleCoderBase):\n  \"\"\"Coder using dill's pickle functionality.\"\"\"\n  def __init__(self):\n    if not dill:\n      raise RuntimeError(\n          \"This pipeline contains a DillCoder which requires \"\n          \"the dill package. Install the dill package with the dill extra \"\n          \"e.g. apache-beam[dill]\")\n\n  def _create_impl(self):\n    return coder_impl.CallbackCoderImpl(maybe_dill_dumps, maybe_dill_loads)\n\n\nclass CloudpickleCoder(_PickleCoderBase):\n  \"\"\"Coder using Apache Beam's vendored Cloudpickle pickler.\"\"\"\n  def _create_impl(self):\n    return coder_impl.CallbackCoderImpl(\n        cloudpickle_pickler.dumps, cloudpickle_pickler.loads)\n\n\nclass DeterministicFastPrimitivesCoderV2(FastCoder):\n  \"\"\"Throws runtime errors when encoding non-deterministic values.\"\"\"\n  def __init__(self, coder, step_label):","sourceCodeStart":909,"sourceCodeEnd":945,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/coders/coders.py#L909-L945","documentation":"DillCoder serializes objects with the optional 'dill' package. If dill is not importable in the environment, __init__ raises RuntimeError immediately so the pipeline fails fast with an actionable install hint instead of failing later during serialization.","triggerScenarios":"Using a transform (e.g. DillPickler-based lambdas/legacy pickling paths) that yields a DillCoder while the 'dill' package is not installed in the Python environment running the pipeline.","commonSituations":"Deploying a Beam pipeline to Dataflow or another runner where the base environment lacks dill; forgetting the [dill] extra when installing apache-beam; using pinned/dry environments for CI.","solutions":["Install dill: pip install apache-beam[dill] (or pip install dill)","Pin dill in requirements.txt / setup.py so the worker environment includes it","Avoid constructs that require DillCoder (e.g. dill-based pickling of lambdas) if dill cannot be installed"],"exampleFix":"// before\npip install apache-beam\n// after\npip install 'apache-beam[dill]'","handlingStrategy":"validation","validationCode":"import importlib.util\nif importlib.util.find_spec('dill') is None:\n    raise SystemExit(\"Install the dill package: pip install 'apache-beam[dill]'\")","typeGuard":"def dill_available() -> bool:\n    import importlib.util\n    return importlib.util.find_spec('dill') is not None","tryCatchPattern":"try:\n    run_pipeline(pipeline_options)\nexcept RuntimeError as e:\n    if 'DillCoder' in str(e):\n        install_hint('pip install apache-beam[dill]')\n    raise","preventionTips":["Add the [dill] extra to apache-beam installs in all environments","Pin dill in requirements.txt so workers get it","Smoke-test the pipeline locally before submitting to a runner"],"tags":["python","missing-dependency","apache-beam"],"backgroundTag":"missing-optional-dependency","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T21:17:11.552Z"}