chroma-core/chroma · error · InvalidHTTPVersion

InvalidHTTPVersion

InvalidHTTPVersion

Error message

HTTP version {http_version} is not supported

What it means

Server middleware guard (check_http_version_middleware): the FastAPI server only supports specific HTTP protocol versions; requests arriving with an unsupported scope http_version are rejected before routing.

Solutions

  1. Connect over HTTP/1.1 or HTTP/2 as supported by the server
  2. Check proxies/clients downgrading or upgrading the protocol unexpectedly
  3. Upgrade the client stack if it speaks an unsupported HTTP version
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at chromadb/server/fastapi/__init__.py:149 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of chroma-core/chroma@aecdd12c8a (2026-08-16). Data as JSON: /api/errors/12a79fb627b4352f. Report an issue: GitHub.

Appendix: source

Thrown at chromadb/server/fastapi/__init__.py:149

            content={"error": "InvalidArgumentError", "message": str(e)},
            status_code=400,
        )
    except TypeError as e:
        return ORJSONResponse(
            content={"error": "InvalidArgumentError", "message": str(e)},
            status_code=400,
        )
    except Exception as e:
        logger.exception(e)
        return ORJSONResponse(content={"error": repr(e)}, status_code=500)


async def check_http_version_middleware(
    request: Request, call_next: Callable[[Request], Any]
) -> Response:
    http_version = request.scope.get("http_version")
    if http_version not in ["1.1", "2"]:
        raise InvalidHTTPVersion(f"HTTP version {http_version} is not supported")
    return await call_next(request)


D = TypeVar("D", bound=BaseModel, contravariant=True)


def validate_model(model: Type[D], data: Any) -> D:  # type: ignore
    """Used for backward compatibility with Pydantic 1.x"""
    try:
        return model.model_validate(data)  # pydantic 2.x
    except AttributeError:
        return model.parse_obj(data)  # pydantic 1.x


class ChromaAPIRouter(fastapi.APIRouter):  # type: ignore
    # A simple subclass of fastapi's APIRouter which treats URLs with a
    # trailing "/" the same as URLs without. Docs will only contain URLs
    # without trailing "/"s.

View on GitHub (pinned to aecdd12c8a)