{"record":{"id":"7cd795f3c4075b5b","repo":"langchain-ai/langgraph","slug":"expected-str-datetime-tzinfo-or-none-for-timezon","errorCode":null,"errorMessage":"Expected str, datetime.tzinfo, or None for timezone, got {type(tz).__name__}","messagePattern":"Expected str, datetime\\.tzinfo, or None for timezone, got (.+?)","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"libs/sdk-py/langgraph_sdk/_shared/utilities.py","lineNumber":158,"sourceCode":"          otherwise ``tzname(None)`` is used.\n        - ``None`` (returned as ``None``)\n    \"\"\"\n    if tz is None or isinstance(tz, str):\n        return tz\n    if isinstance(tz, tzinfo):\n        # ZoneInfo objects have a .key attribute with the IANA name\n        key = getattr(tz, \"key\", None)\n        if isinstance(key, str):\n            return key\n        # Fall back to tzname for fixed-offset timezones like datetime.timezone.utc\n        name = tz.tzname(None)\n        if name is not None:\n            return name\n        raise ValueError(\n            f\"Cannot determine timezone name from {tz!r}. \"\n            \"Use a zoneinfo.ZoneInfo instance or pass a string like 'America/New_York'.\"\n        )\n    raise TypeError(\n        f\"Expected str, datetime.tzinfo, or None for timezone, got {type(tz).__name__}\"\n    )\n\n\ndef _default_port(scheme: str) -> int:\n    return 443 if scheme == \"https\" else 80\n\n\ndef _validate_reconnect_location(base_url: httpx.URL, location: str) -> str:\n    \"\"\"Validate that a reconnect Location URL is same-origin as the base URL.\n\n    Raises ValueError if the Location header points to a different origin\n    (scheme + host + port), which would leak credentials to an external server.\n    \"\"\"\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","sourceCodeStart":140,"sourceCodeEnd":176,"githubUrl":"https://github.com/langchain-ai/langgraph/blob/38031739e551638e373fb553453256c23feeb41f/libs/sdk-py/langgraph_sdk/_shared/utilities.py#L140-L176","documentation":"Error \"Expected str, datetime.tzinfo, or None for timezone, got {type(tz).__name__}\" thrown in langchain-ai/langgraph.","triggerScenarios":"Thrown at libs/sdk-py/langgraph_sdk/_shared/utilities.py:158 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"}