langchain-ai/langgraph · error · ValueError
At least one of func or afunc must be provided.
Error message
At least one of func or afunc must be provided.
What it means
Constructor guard for the internal RunnableCallable: neither a sync func nor an async afunc was supplied, so the callable would have nothing to invoke. This fires when code constructs the wrapper with no function at all — a programming error in how the runnable is instantiated, fixed by passing at least one callable.
Solutions
- Provide a sync function, an async function, or both when constructing the runnable.
- Check upstream factory code that may pass None callables.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at libs/langgraph/langgraph/_internal/_runnable.py:336 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of langchain-ai/langgraph@38031739e5 (2026-08-26).
Data as JSON: /api/errors/caafc61536a92870.
Report an issue: GitHub.
Appendix: source
Thrown at libs/langgraph/langgraph/_internal/_runnable.py:336
if func.__name__ != "<lambda>":
self.name = func.__name__
except AttributeError:
pass
elif afunc:
try:
self.name = afunc.__name__
except AttributeError:
pass
self.func = func
self.afunc = afunc
self.tags = tags
self.kwargs = kwargs
self.trace = trace
self.recurse = recurse
self.explode_args = explode_args
# check signature
if func is None and afunc is None:
raise ValueError("At least one of func or afunc must be provided.")
self.func_accepts: dict[str, tuple[str, Any]] = {}
params = inspect.signature(cast(Callable, func or afunc)).parameters
for kw, typ, runtime_key, default in KWARGS_CONFIG_KEYS:
p = params.get(kw)
if p is None or p.kind not in VALID_KINDS:
# If parameter is not found or is not a valid kind, skip
continue
if typ != (ANY_TYPE,) and p.annotation not in typ:
# A specific type is required, but the function annotation does
# not match the expected type.
# If this is a config parameter with incorrect typing, emit a warning
# because we used to support any type but are moving towards more correct typing
if kw == "config" and p.annotation != inspect.Parameter.empty:View on GitHub (pinned to 38031739e5)