langchain-ai/langgraph · error · ValueError

can't specify timeout for non-blocking acquire

Error message

can't specify timeout for non-blocking acquire

What it means

Error "can't specify timeout for non-blocking acquire" thrown in langchain-ai/langgraph.

Source

Thrown at libs/langgraph/langgraph/_internal/_queue.py:50

                    self._getters.remove(getter)
                except ValueError:
                    # The getter could be removed from self._getters by a
                    # previous put_nowait call.
                    pass
                if not self.empty() and not getter.cancelled():
                    # We were woken up by put_nowait(), but can't take
                    # the call.  Wake up the next in line.
                    self._wakeup_next(self._getters)
                raise


class Semaphore(threading.Semaphore):
    """Semaphore subclass with a wait() method."""

    def wait(self, blocking: bool = True, timeout: float | None = None):
        """Block until the semaphore can be acquired, but don't acquire it."""
        if not blocking and timeout is not None:
            raise ValueError("can't specify timeout for non-blocking acquire")
        rc = False
        endtime = None
        with self._cond:
            while self._value == 0:
                if not blocking:
                    break
                if timeout is not None:
                    if endtime is None:
                        endtime = monotonic() + timeout
                    else:
                        timeout = endtime - monotonic()
                        if timeout <= 0:
                            break
                self._cond.wait(timeout)
            else:
                rc = True
        return rc

View on GitHub (pinned to 38031739e5)

When it happens

Trigger: Thrown at libs/langgraph/langgraph/_internal/_queue.py:50 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


AI-assisted analysis of langchain-ai/langgraph@38031739e5 (2026-08-26). Data as JSON: /api/errors/cf9724c41e17d351. Report an issue: GitHub.