[PR #316] [MERGED] fix: examples plan-and-execute.ipynb #1381

Closed
opened 2026-02-20 17:44:35 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langchain-ai/langgraph/pull/316
Author: @Brant-lzh
Created: 4/17/2024
Status: Merged
Merged: 4/29/2024
Merged by: @hinthornw

Base: mainHead: main


📝 Commits (2)

  • e5a27f5 fix: examples plan-and-execute
  • 5136f05 Merge branch 'main' into main

📊 Changes

1 file changed (+4 additions, -4 deletions)

View changed files

📝 examples/plan-and-execute/plan-and-execute.ipynb (+4 -4)

📄 Description

Running plan-and-execute.ipynb reported an error:

File [~/anaconda3/envs/llm/lib/python3.11/site-packages/langgraph/pregel/__init__.py:1033](https://file+.vscode-resource.vscode-cdn.net/home/brant/python/langgraph/examples/plan-and-execute/~/anaconda3/envs/llm/lib/python3.11/site-packages/langgraph/pregel/__init__.py:1033), in _panic_or_proceed(done, inflight, step)
   1031             inflight.pop().cancel()
   1032         # raise the exception
-> 1033         raise exc
   1034         # TODO this is where retry of an entire step would happen
...
---> 90     destinations = [self.ends[r] for r in result]
     91 else:
     92     destinations = result

TypeError: 'bool' object is not iterable

I found that only by returning str will it be converted into an array

langgraph/graph/graph.py

    async def _aroute(
        self,
        input: Any,
        config: RunnableConfig,
        *,
        reader: Optional[Callable[[], Any]],
        writer: Callable[[str], Optional[Runnable]],
    ) -> Runnable:
        result = await self.condition.ainvoke(
            reader(config) if reader else input, config
        )
        if isinstance(result, str):     #this 
            result = [result]
        if self.ends:
            destinations = [self.ends[r] for r in result]
        else:
            destinations = result
        return writer(destinations) or input

So I decided to edge func back str like PR did, and the result worked normally.
I wonder if I made the right modification? thx.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/langchain-ai/langgraph/pull/316 **Author:** [@Brant-lzh](https://github.com/Brant-lzh) **Created:** 4/17/2024 **Status:** ✅ Merged **Merged:** 4/29/2024 **Merged by:** [@hinthornw](https://github.com/hinthornw) **Base:** `main` ← **Head:** `main` --- ### 📝 Commits (2) - [`e5a27f5`](https://github.com/langchain-ai/langgraph/commit/e5a27f5c4c33d38573eed6aed00c646e447008cf) fix: examples plan-and-execute - [`5136f05`](https://github.com/langchain-ai/langgraph/commit/5136f056677b06ed707a5274ba02f6ac1b17678d) Merge branch 'main' into main ### 📊 Changes **1 file changed** (+4 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `examples/plan-and-execute/plan-and-execute.ipynb` (+4 -4) </details> ### 📄 Description Running plan-and-execute.ipynb reported an error: ``` File [~/anaconda3/envs/llm/lib/python3.11/site-packages/langgraph/pregel/__init__.py:1033](https://file+.vscode-resource.vscode-cdn.net/home/brant/python/langgraph/examples/plan-and-execute/~/anaconda3/envs/llm/lib/python3.11/site-packages/langgraph/pregel/__init__.py:1033), in _panic_or_proceed(done, inflight, step) 1031 inflight.pop().cancel() 1032 # raise the exception -> 1033 raise exc 1034 # TODO this is where retry of an entire step would happen ... ---> 90 destinations = [self.ends[r] for r in result] 91 else: 92 destinations = result TypeError: 'bool' object is not iterable ``` I found that only by returning str will it be converted into an array `langgraph/graph/graph.py` ```python async def _aroute( self, input: Any, config: RunnableConfig, *, reader: Optional[Callable[[], Any]], writer: Callable[[str], Optional[Runnable]], ) -> Runnable: result = await self.condition.ainvoke( reader(config) if reader else input, config ) if isinstance(result, str): #this result = [result] if self.ends: destinations = [self.ends[r] for r in result] else: destinations = result return writer(destinations) or input ``` So I decided to edge func back str like PR did, and the result worked normally. I wonder if I made the right modification? thx. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-20 17:44:35 -05:00
yindo closed this issue 2026-02-20 17:44:35 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraph#1381