langchain-ai/langgraph · error · ValueError

Cannot determine timezone name from {tz!r}. Use a zoneinfo.Z

Error message

Cannot determine timezone name from {tz!r}. Use a zoneinfo.ZoneInfo instance or pass a string like 'America/New_York'.

What it means

Error "Cannot determine timezone name from {tz!r}. Use a zoneinfo.ZoneInfo instance or pass a string like 'America/New_York'." thrown in langchain-ai/langgraph.

Source

Thrown at libs/sdk-py/langgraph_sdk/_shared/utilities.py:154

    Accepts:
        - A string (returned as-is, assumed to be an IANA timezone name)
        - A ``datetime.tzinfo`` instance (e.g. ``zoneinfo.ZoneInfo("America/New_York")``,
          ``datetime.timezone.utc``). The ``key`` attribute is used if available,
          otherwise ``tzname(None)`` is used.
        - ``None`` (returned as ``None``)
    """
    if tz is None or isinstance(tz, str):
        return tz
    if isinstance(tz, tzinfo):
        # ZoneInfo objects have a .key attribute with the IANA name
        key = getattr(tz, "key", None)
        if isinstance(key, str):
            return key
        # Fall back to tzname for fixed-offset timezones like datetime.timezone.utc
        name = tz.tzname(None)
        if name is not None:
            return name
        raise ValueError(
            f"Cannot determine timezone name from {tz!r}. "
            "Use a zoneinfo.ZoneInfo instance or pass a string like 'America/New_York'."
        )
    raise TypeError(
        f"Expected str, datetime.tzinfo, or None for timezone, got {type(tz).__name__}"
    )


def _default_port(scheme: str) -> int:
    return 443 if scheme == "https" else 80


def _validate_reconnect_location(base_url: httpx.URL, location: str) -> str:
    """Validate that a reconnect Location URL is same-origin as the base URL.

    Raises ValueError if the Location header points to a different origin
    (scheme + host + port), which would leak credentials to an external server.
    """

View on GitHub (pinned to 38031739e5)

When it happens

Trigger: Thrown at libs/sdk-py/langgraph_sdk/_shared/utilities.py:154 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/a0602b9ad832e027. Report an issue: GitHub.