langchain-ai/langgraph · error · ValueError

Refusing to follow cross-origin reconnect Location: {locatio

Error message

Refusing to follow cross-origin reconnect Location: {location!r} (origin {loc_origin}) does not match base URL origin {base_origin}

What it means

Error "Refusing to follow cross-origin reconnect Location: {location!r} (origin {loc_origin}) does not match base URL origin {base_origin}" thrown in langchain-ai/langgraph.

Source

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

    """
    parsed = urlparse(location)
    # Relative URLs are safe — they resolve against the base
    if not parsed.scheme and not parsed.netloc:
        return location
    # Compare origin components (normalize default ports to avoid mismatches)
    base_scheme = str(base_url.scheme)
    base_origin = (
        base_scheme,
        str(base_url.host),
        base_url.port or _default_port(base_scheme),
    )
    loc_origin = (
        parsed.scheme,
        parsed.hostname or "",
        parsed.port or _default_port(parsed.scheme),
    )
    if base_origin != loc_origin:
        raise ValueError(
            f"Refusing to follow cross-origin reconnect Location: {location!r} "
            f"(origin {loc_origin}) does not match base URL origin {base_origin}"
        )
    return location


def _provided_vals(d: Mapping[str, Any]) -> dict[str, Any]:
    return {k: v for k, v in d.items() if v is not None}


def _quote_path_param(value: Any) -> str:
    """Encode a value for safe interpolation into a request path segment.

    Path segments are encoded with ``safe=""`` so that ``/`` and other reserved
    characters are escaped. Standalone dot-segments (``.`` and ``..``) are also
    encoded because some URL-handling stacks (including ``httpx``) collapse
    them client-side as relative-path traversal before transmission. The value
    is coerced to ``str`` so callers can pass ``uuid.UUID`` and similar types

View on GitHub (pinned to 38031739e5)

When it happens

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