langchain-ai/langgraph · error · TypeError

path parameter must not be bytes; pass a str or uuid.UUID

Error message

path parameter must not be bytes; pass a str or uuid.UUID

What it means

Error "path parameter must not be bytes; pass a str or uuid.UUID" thrown in langchain-ai/langgraph.

Source

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

    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
    directly without changing call sites.

    A properly formed identifier (for example, a standard UUID, which contains
    no dots or reserved characters) round-trips through this function
    unchanged.

    Raises:
        TypeError: If `value` is `None` or a `bytes`/`bytearray` instance.
            Coercing those would produce misleading paths (e.g. `/threads/None`),
            so surface the caller bug instead.
    """
    if value is None:
        raise TypeError("path parameter must not be None")
    if isinstance(value, (bytes, bytearray)):
        raise TypeError("path parameter must not be bytes; pass a str or uuid.UUID")
    quoted = quote(str(value), safe="")
    # Bare "." or ".." (or any all-dot string) acts as a relative-path segment
    # that some HTTP stacks (including ``httpx``) collapse client-side before
    # transmission. Encode the dots so the segment becomes opaque to that
    # logic. Mixed values like "agent.v1" are unaffected.
    if quoted and all(c == "." for c in quoted):
        quoted = "%2E" * len(quoted)
    return quoted


_registered_transports: list[httpx.ASGITransport] = []


# Do not move; this is used in the server.
def configure_loopback_transports(app: Any) -> None:
    for transport in _registered_transports:
        transport.app = app

View on GitHub (pinned to 38031739e5)

When it happens

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