Error2 reports
Fix UnboundLocalError
in LangGraph
✅ Solution
This error usually arises when a variable is referenced before it's assigned a value within a specific scope, often inside a conditional block. To fix it, ensure the variable is initialized with a default value before the conditional statement or that every possible execution path within the conditional assigns a value to the variable before it's used. For `Command(resume=None)` cases, initialize `resume_is_map` before the conditional block checking for its presence to avoid the error.
Related Issues
Real GitHub issues where developers encountered this error:
Timeline
First reported:Mar 4, 2026
Last reported:15h ago