langchain-ai/langgraph · error · ValueError

Entrypoint function must have at least one parameter

Error message

Entrypoint function must have at least one parameter

What it means

Raised when converting a function to an entrypoint and the function signature has zero parameters — an entrypoint must accept at least one argument (typically the input/state) so the runtime can invoke it.

Solutions

  1. Add at least one parameter to the entrypoint function, e.g. `def main(state: State):`
  2. Use a lambda/partial to supply a dummy parameter if the function genuinely needs no input
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at libs/langgraph/langgraph/func/__init__.py:538 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/6daedb96808ae3fa. Report an issue: GitHub.

Appendix: source

Thrown at libs/langgraph/langgraph/func/__init__.py:538

            func: The function to convert. Support both sync and async functions.

        Returns:
            A Pregel graph.
        """
        # wrap generators in a function that writes to StreamWriter
        if inspect.isgeneratorfunction(func) or inspect.isasyncgenfunction(func):
            raise NotImplementedError(
                "Generators are not supported in the Functional API."
            )

        bound = get_runnable_for_entrypoint(func)
        stream_mode: StreamMode = "updates"

        # get input and output types
        sig = inspect.signature(func)
        first_parameter_name = next(iter(sig.parameters.keys()), None)
        if not first_parameter_name:
            raise ValueError("Entrypoint function must have at least one parameter")
        input_type = (
            sig.parameters[first_parameter_name].annotation
            if sig.parameters[first_parameter_name].annotation
            is not inspect.Signature.empty
            else Any
        )

        def _pluck_return_value(value: Any) -> Any:
            """Extract the return_ value the entrypoint.final object or passthrough."""
            return value.value if isinstance(value, entrypoint.final) else value

        def _pluck_save_value(value: Any) -> Any:
            """Get save value from the entrypoint.final object or passthrough."""
            return value.save if isinstance(value, entrypoint.final) else value

        output_type, save_type = Any, Any
        if sig.return_annotation is not inspect.Signature.empty:
            # User does not parameterize entrypoint.final properly

View on GitHub (pinned to 38031739e5)