{"record":{"id":"dc42ab76d5556bbd","repo":"langchain-ai/langgraph","slug":"a-future-is-required-for-source-argument","errorCode":null,"errorMessage":"A future is required for source argument","messagePattern":"A future is required for source argument","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"libs/langgraph/langgraph/_internal/_future.py","lineNumber":92,"sourceCode":"        exception = source.exception()\n        if exception is not None:\n            dest.set_exception(_convert_future_exc(exception))\n        else:\n            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:","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/langchain-ai/langgraph/blob/38031739e551638e373fb553453256c23feeb41f/libs/langgraph/langgraph/_internal/_future.py#L74-L110","documentation":"Type guard at the top of _chain_future: the 'source' argument is neither an asyncio.Future nor a concurrent.futures.Future, so chaining cannot be set up and TypeError is raised before attaching done-callbacks.","triggerScenarios":"Thrown at libs/langgraph/langgraph/_internal/_future.py:92 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a real future (asyncio.Future, concurrent.futures.Future, or a Task) as the source.","If you have a coroutine, wrap it with asyncio.ensure_future first."],"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"}