BerriAI/litellm · error · HTTPException

Method {request.method} is not allowed for pass-through endp

Error message

Method {request.method} is not allowed for pass-through endpoint {path}.

What it means

The HTTP verb used by the caller is not in the methods allowed for the registered pass-through route. The route exists but only accepts the method list configured when it was registered, so FastAPI routing forwards here and the handler rejects the request with 405 semantics.

Source

Thrown at litellm/proxy/pass_through_endpoints/pass_through_endpoints.py:1735

                custom_body_data,
                file_data,
                stream,
            ) = await _parse_request_data_by_content_type(request)

            if not InitPassThroughEndpointHelpers.is_registered_pass_through_route(route=path):
                raise HTTPException(
                    status_code=404,
                    detail=f"Pass-through endpoint {endpoint} not found. This could have been deleted or not yet added to the proxy.",
                )

            passthrough_params: Final = InitPassThroughEndpointHelpers.get_registered_pass_through_route(
                route=path, method=request.method
            )
            if (
                passthrough_params is None
                and InitPassThroughEndpointHelpers.get_registered_pass_through_route(route=path) is not None
            ):
                raise HTTPException(
                    status_code=status.HTTP_405_METHOD_NOT_ALLOWED,
                    detail=f"Method {request.method} is not allowed for pass-through endpoint {path}.",
                )
            target_params: Final = {
                "target": target,
                "custom_headers": custom_headers,
                "forward_headers": _forward_headers,
                "merge_query_params": _merge_query_params,
                "cost_per_request": cost_per_request,
                "guardrails": None,
                "timeout": timeout,
            }

            if passthrough_params is not None:
                target_params.update(passthrough_params.get("passthrough_params", {}))

            # Extract and cast parameters with proper types
            param_target: Final = target_params.get("target") or target

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Use an HTTP method allowed for this pass-through endpoint (check its configured methods list).
  2. Update the endpoint configuration to allow the desired method if appropriate.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/proxy/pass_through_endpoints/pass_through_endpoints.py:1735 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/05538578333160e4. Report an issue: GitHub.