BerriAI/litellm · error · ValueError

Unsupported HTTP method: {method}

Error message

Unsupported HTTP method: {method}

What it means

Error "Unsupported HTTP method: {method}" thrown in BerriAI/litellm.

Source

Thrown at litellm/llms/custom_httpx/container_handler.py:271

        # An empty dict passed as `params` to httpx strips any existing query
        # string from the URL (e.g. ?api-version=...).  Use None instead so
        # httpx leaves the URL's own query string intact.
        effective_params: Final = query_params or None

        try:
            if method == "GET":
                response = http_client.get(url=url, headers=headers, params=effective_params)
            elif method == "DELETE":
                response = http_client.delete(url=url, headers=headers, params=effective_params)
            elif method == "POST":
                if is_multipart and "file" in kwargs:
                    files, headers = _prepare_multipart_file_upload(kwargs["file"], headers)
                    response = http_client.post(url=url, headers=headers, params=effective_params, files=files)
                else:
                    response = http_client.post(url=url, headers=headers, params=effective_params)
            else:
                raise ValueError(f"Unsupported HTTP method: {method}")

            # For binary responses, return raw content
            if returns_binary:
                return response.content

            # Check for error response
            response_json: Final = response.json()
            if "error" in response_json:
                from litellm.llms.base_llm.chat.transformation import BaseLLMException

                error_msg: Final = response_json.get("error", {}).get("message", str(response_json))
                raise BaseLLMException(
                    status_code=response.status_code,
                    message=error_msg,
                    headers=dict(response.headers),
                )

            # Parse response

View on GitHub (pinned to 6c2dcb801b)

Solutions

  1. Use a supported HTTP method for the container endpoint.

When it happens

Trigger: Thrown at litellm/llms/custom_httpx/container_handler.py:271 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15). Data as JSON: /api/errors/f417b1091cee38b1. Report an issue: GitHub.