{"record":{"id":"981953c618e7187e","repo":"langchain-ai/langgraph","slug":"generators-are-not-supported-in-the-functional-api","errorCode":null,"errorMessage":"Generators are not supported in the Functional API.","messagePattern":"Generators are not supported in the Functional API\\.","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"libs/langgraph/langgraph/func/__init__.py","lineNumber":527,"sourceCode":"        \"\"\"Value to return. A value will always be returned even if it is `None`.\"\"\"\n        save: S\n        \"\"\"The value for the state for the next checkpoint.\n\n        A value will always be saved even if it is `None`.\n        \"\"\"\n\n    def __call__(self, func: Callable[..., Any]) -> Pregel:\n        \"\"\"Convert a function into a Pregel graph.\n\n        Args:\n            func: The function to convert. Support both sync and async functions.\n\n        Returns:\n            A Pregel graph.\n        \"\"\"\n        # wrap generators in a function that writes to StreamWriter\n        if inspect.isgeneratorfunction(func) or inspect.isasyncgenfunction(func):\n            raise NotImplementedError(\n                \"Generators are not supported in the Functional API.\"\n            )\n\n        bound = get_runnable_for_entrypoint(func)\n        stream_mode: StreamMode = \"updates\"\n\n        # get input and output types\n        sig = inspect.signature(func)\n        first_parameter_name = next(iter(sig.parameters.keys()), None)\n        if not first_parameter_name:\n            raise ValueError(\"Entrypoint function must have at least one parameter\")\n        input_type = (\n            sig.parameters[first_parameter_name].annotation\n            if sig.parameters[first_parameter_name].annotation\n            is not inspect.Signature.empty\n            else Any\n        )\n","sourceCodeStart":509,"sourceCodeEnd":545,"githubUrl":"https://github.com/langchain-ai/langgraph/blob/38031739e551638e373fb553453256c23feeb41f/libs/langgraph/langgraph/func/__init__.py#L509-L545","documentation":"Error \"Generators are not supported in the Functional API.\" thrown in langchain-ai/langgraph.","triggerScenarios":"Thrown at libs/langgraph/langgraph/func/__init__.py:527 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"38031739e551638e373fb553453256c23feeb41f","analyzedAt":"2026-08-26T18:02:49.312Z","schemaVersion":2},"datasetVersion":"2026-08-26T21:11:00.512Z"}