{"record":{"id":"ce6ddc9ae25ed47f","repo":"BerriAI/litellm","slug":"unsupported-http-method-method-ce6ddc","errorCode":null,"errorMessage":"Unsupported HTTP method: {method}","messagePattern":"Unsupported HTTP method: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"warning","filePath":"litellm/llms/oci/common_utils.py","lineNumber":218,"sourceCode":"\n# ---------------------------------------------------------------------------\n# Signing implementations (shared by chat, embed, and rerank configs)\n# ---------------------------------------------------------------------------\n\n\ndef sign_with_oci_signer(\n    headers: dict,\n    optional_params: dict,\n    request_data: dict,\n    api_base: str,\n) -> tuple[dict, bytes]:\n    \"\"\"Sign a request using an OCI SDK Signer object passed in optional_params.\"\"\"\n    oci_signer: Final = optional_params.get(\"oci_signer\")\n    body: Final = json.dumps(request_data).encode(\"utf-8\")\n    method: Final = str(optional_params.get(\"method\", \"POST\")).upper()\n\n    if method not in {\"POST\", \"GET\", \"PUT\", \"DELETE\", \"PATCH\"}:\n        raise ValueError(f\"Unsupported HTTP method: {method}\")\n\n    prepared_headers: Final = {**headers}\n    prepared_headers.setdefault(\"content-type\", \"application/json\")\n    prepared_headers.setdefault(\"content-length\", str(len(body)))\n\n    request_wrapper: Final = OCIRequestWrapper(method=method, url=api_base, headers=prepared_headers, body=body)\n\n    if oci_signer is None:\n        raise ValueError(\"oci_signer cannot be None when calling sign_with_oci_signer\")\n\n    try:\n        oci_signer.do_request_sign(request_wrapper, enforce_content_headers=True)\n    except Exception as e:\n        raise OCIError(\n            status_code=500,\n            message=(\n                f\"Failed to sign request with provided oci_signer: {e}. \"\n                \"The signer must implement the OCI SDK Signer interface with a \"","sourceCodeStart":200,"sourceCodeEnd":236,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/oci/common_utils.py#L200-L236","documentation":"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.","triggerScenarios":"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'.","commonSituations":"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.","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."],"exampleFix":"# before\noptional_params[\"method\"] = \"HEAD\"  # ValueError\n\n# after\noptional_params.pop(\"method\", None)  # default POST","handlingStrategy":"validation","validationCode":"method = str(optional_params.get(\"method\", \"POST\")).upper()\nassert method in {\"POST\", \"GET\", \"PUT\", \"DELETE\", \"PATCH\"}, f\"unsupported method {method}\"","typeGuard":"from typing import Any\n\ndef is_supported_oci_method(m: Any) -> bool:\n    return isinstance(m, str) and m.upper() in {\"POST\", \"GET\", \"PUT\", \"DELETE\", \"PATCH\"}","tryCatchPattern":"try:\n    sign_with_oci_signer(headers, optional_params, data, url)\nexcept ValueError as e:\n    if \"Unsupported HTTP method\" in str(e):\n        optional_params.pop(\"method\", None)  # fall back to default POST\n    raise","preventionTips":["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."],"tags":["oci","validation","http-method","signing"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}