BerriAI/litellm · warning · ValueError
Unsupported HTTP method: {method}
Error message
Unsupported HTTP method: {method} What it means
sign_with_oci_signer whitelists HTTP methods {POST, GET, PUT, DELETE, PATCH} before building the OCIRequestWrapper; anything else in optional_params['method'] (after str().upper()) — e.g. 'HEAD', 'OPTIONS', a typo, or a non-method string — raises ValueError because the OCI signing scheme is only implemented for those verbs.
Source
Thrown at litellm/llms/oci/common_utils.py:218
# ---------------------------------------------------------------------------
# Signing implementations (shared by chat, embed, and rerank configs)
# ---------------------------------------------------------------------------
def sign_with_oci_signer(
headers: dict,
optional_params: dict,
request_data: dict,
api_base: str,
) -> tuple[dict, bytes]:
"""Sign a request using an OCI SDK Signer object passed in optional_params."""
oci_signer: Final = optional_params.get("oci_signer")
body: Final = json.dumps(request_data).encode("utf-8")
method: Final = str(optional_params.get("method", "POST")).upper()
if method not in {"POST", "GET", "PUT", "DELETE", "PATCH"}:
raise ValueError(f"Unsupported HTTP method: {method}")
prepared_headers: Final = {**headers}
prepared_headers.setdefault("content-type", "application/json")
prepared_headers.setdefault("content-length", str(len(body)))
request_wrapper: Final = OCIRequestWrapper(method=method, url=api_base, headers=prepared_headers, body=body)
if oci_signer is None:
raise ValueError("oci_signer cannot be None when calling sign_with_oci_signer")
try:
oci_signer.do_request_sign(request_wrapper, enforce_content_headers=True)
except Exception as e:
raise OCIError(
status_code=500,
message=(
f"Failed to sign request with provided oci_signer: {e}. "
"The signer must implement the OCI SDK Signer interface with a "View on GitHub (pinned to 6c2dcb801b)
Solutions
- Use one of the supported verbs; for chat/embeddings the default POST is correct — simply omit 'method'.
- If a foreign 'method' key leaks into optional_params from your stack, strip it before calling litellm.
- For health checks, hit the endpoint with an unsigned GET or use the OCI SDK instead of forcing HEAD through signing.
Example fix
# before
optional_params["method"] = "HEAD" # ValueError
# after
optional_params.pop("method", None) # default POST Defensive patterns
Strategy: validation
Validate before calling
method = str(optional_params.get("method", "POST")).upper()
assert method in {"POST", "GET", "PUT", "DELETE", "PATCH"}, f"unsupported method {method}" Type guard
from typing import Any
def is_supported_oci_method(m: Any) -> bool:
return isinstance(m, str) and m.upper() in {"POST", "GET", "PUT", "DELETE", "PATCH"} Try / catch
try:
sign_with_oci_signer(headers, optional_params, data, url)
except ValueError as e:
if "Unsupported HTTP method" in str(e):
optional_params.pop("method", None) # fall back to default POST
raise Prevention
- Omit 'method' from optional_params unless you truly need a non-default verb.
- Namespace your own keys to avoid colliding with litellm's optional_params contract.
- Whitelist verbs at the boundary of your HTTP layer.
When it happens
Trigger: Passing optional_params={'method': 'head'} or 'options' when calling the OCI signing helper directly; a framework injecting its own 'method' key into optional_params (e.g. a generic HTTP layer reusing the dict); misspellings like 'pos'.
Common situations: Integrations that forward their transport's method into optional_params; code copied from another provider expecting lowercase verbs (handled) but then extending to unsupported verbs; generic retry layers attempting HEAD health checks through the signing path.
Related errors
- Invalid OCI region {region!r}: must match ^[a-z][a-z0-9-]{{0
- Failed to sign request with provided oci_signer: {e}. The si
- Private key is required for OCI authentication. Provide eith
- oci_compartment_id is required for OCI embedding requests. P
- Invalid mode: {custom_auth_settings['mode']}
AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15).
Data as JSON: /api/errors/ce6ddc9ae25ed47f.
Report an issue: GitHub.