langgraph icon indicating copy to clipboard operation
langgraph copied to clipboard

fix(pregel): handle EmptyInputError for Command with stream_mode='values'

Open nicolasmota opened this issue 1 month ago • 1 comments

I'm facing some errors related to undeclared resume_is_map variable.

  File "/app/venv/lib/python3.11/site-packages/langgraph/pregel/main.py", line 3179, in ainvoke
    async for chunk in self.astream(
  File "/app/venv/lib/python3.11/site-packages/langgraph/pregel/main.py", line 2914, in astream
    async with AsyncPregelLoop(
  File "/app/venv/lib/python3.11/site-packages/langgraph/pregel/_loop.py", line 1344, in __aenter__
    self.updated_channels = self._first(
  File "/app/venv/lib/python3.11/site-packages/langgraph/pregel/_loop.py", line 722, in _first
    if not writes and not resume_is_map:
UnboundLocalError: cannot access local variable 'resume_is_map' where it is not associated with a value
  • This PR fixes this error declaring the default value for this Variable being possible to throw the error:EmptyInputError
  • Added tests to ensure that invoking Command() with stream_mode='values' correctly raises EmptyInputError when input is empty, and that Command(resume=...) works as expected.
  • Updated imports to include EmptyInputError in relevant test files.

nicolasmota avatar Nov 18 '25 16:11 nicolasmota

@nicolasmota is attempting to deploy a commit to the LangChain Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar Nov 18 '25 16:11 vercel[bot]