{"record":{"id":"305ac3feefcef10b","repo":"langchain-ai/langgraph","slug":"refusing-to-follow-cross-origin-reconnect-location","errorCode":null,"errorMessage":"Refusing to follow cross-origin reconnect Location: {location!r} (origin {loc_origin}) does not match base URL origin {base_origin}","messagePattern":"Refusing to follow cross-origin reconnect Location: (.+?) \\(origin (.+?)\\) does not match base URL origin (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"libs/sdk-py/langgraph_sdk/_shared/utilities.py","lineNumber":190,"sourceCode":"    \"\"\"\n    parsed = urlparse(location)\n    # Relative URLs are safe — they resolve against the base\n    if not parsed.scheme and not parsed.netloc:\n        return location\n    # Compare origin components (normalize default ports to avoid mismatches)\n    base_scheme = str(base_url.scheme)\n    base_origin = (\n        base_scheme,\n        str(base_url.host),\n        base_url.port or _default_port(base_scheme),\n    )\n    loc_origin = (\n        parsed.scheme,\n        parsed.hostname or \"\",\n        parsed.port or _default_port(parsed.scheme),\n    )\n    if base_origin != loc_origin:\n        raise ValueError(\n            f\"Refusing to follow cross-origin reconnect Location: {location!r} \"\n            f\"(origin {loc_origin}) does not match base URL origin {base_origin}\"\n        )\n    return location\n\n\ndef _provided_vals(d: Mapping[str, Any]) -> dict[str, Any]:\n    return {k: v for k, v in d.items() if v is not None}\n\n\ndef _quote_path_param(value: Any) -> str:\n    \"\"\"Encode a value for safe interpolation into a request path segment.\n\n    Path segments are encoded with ``safe=\"\"`` so that ``/`` and other reserved\n    characters are escaped. Standalone dot-segments (``.`` and ``..``) are also\n    encoded because some URL-handling stacks (including ``httpx``) collapse\n    them client-side as relative-path traversal before transmission. The value\n    is coerced to ``str`` so callers can pass ``uuid.UUID`` and similar types","sourceCodeStart":172,"sourceCodeEnd":208,"githubUrl":"https://github.com/langchain-ai/langgraph/blob/38031739e551638e373fb553453256c23feeb41f/libs/sdk-py/langgraph_sdk/_shared/utilities.py#L172-L208","documentation":"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.","triggerScenarios":"Thrown at libs/sdk-py/langgraph_sdk/_shared/utilities.py:190 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"38031739e551638e373fb553453256c23feeb41f","analyzedAt":"2026-08-26T18:02:49.312Z","schemaVersion":2},"datasetVersion":"2026-08-26T21:11:00.512Z"}