{"record":{"id":"536ba0833b9ec5f6","repo":"langchain-ai/langgraph","slug":"a-future-is-required-for-destination-argument","errorCode":null,"errorMessage":"A future is required for destination argument","messagePattern":"A future is required for destination argument","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"libs/langgraph/langgraph/_internal/_future.py","lineNumber":96,"sourceCode":"            result = source.result()\n            dest.set_result(result)\n\n\ndef _chain_future(source: AnyFuture, destination: AnyFuture) -> None:\n    \"\"\"Chain two futures so that when one completes, so does the other.\n\n    The result (or exception) of source will be copied to destination.\n    If destination is cancelled, source gets cancelled too.\n    Compatible with both asyncio.Future and concurrent.futures.Future.\n    \"\"\"\n    if not asyncio.isfuture(source) and not isinstance(\n        source, concurrent.futures.Future\n    ):\n        raise TypeError(\"A future is required for source argument\")\n    if not asyncio.isfuture(destination) and not isinstance(\n        destination, concurrent.futures.Future\n    ):\n        raise TypeError(\"A future is required for destination argument\")\n    source_loop = _get_loop(source) if asyncio.isfuture(source) else None\n    dest_loop = _get_loop(destination) if asyncio.isfuture(destination) else None\n\n    def _set_state(future: AnyFuture, other: AnyFuture) -> None:\n        if asyncio.isfuture(future):\n            _copy_future_state(other, future)\n        else:\n            _set_concurrent_future_state(future, other)\n\n    def _call_check_cancel(destination: AnyFuture) -> None:\n        if destination.cancelled():\n            if source_loop is None or source_loop is dest_loop:\n                source.cancel()\n            else:\n                source_loop.call_soon_threadsafe(source.cancel)\n\n    def _call_set_state(source: AnyFuture) -> None:\n        if destination.cancelled() and dest_loop is not None and dest_loop.is_closed():","sourceCodeStart":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/langchain-ai/langgraph/blob/38031739e551638e373fb553453256c23feeb41f/libs/langgraph/langgraph/_internal/_future.py#L78-L114","documentation":"Same guard as for source but on the 'destination' argument of _chain_future: the destination must be an asyncio or concurrent.futures Future, otherwise TypeError is raised because results/exceptions could not be copied into it.","triggerScenarios":"Thrown at libs/langgraph/langgraph/_internal/_future.py:96 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a future object as destination (e.g. loop.create_future()).","Do not pass a plain coroutine or awaitable as destination."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"38031739e551638e373fb553453256c23feeb41f","analyzedAt":"2026-08-26T18:02:49.312Z","contentChangedAt":"2026-08-26T18:02:49.312Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}