{"record":{"id":"90e452f318cf1229","repo":"OpenBB-finance/OpenBB","slug":"invalid-http-method-method-valid-methods","errorCode":null,"errorMessage":"Invalid HTTP method '{method}'. Valid methods: {', '.join(valid_methods)}","messagePattern":"Invalid HTTP method '(.+?)'\\. Valid methods: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"openbb_platform/extensions/mcp_server/openbb_mcp_server/models/mcp_config.py","lineNumber":189,"sourceCode":"        if isinstance(v, str):\n            v = [v]\n\n        if not isinstance(v, list):\n            raise ValueError(\"methods must be a list of strings\")\n\n        # If '*' is present, it should be the only method\n        if \"*\" in v and len(v) > 1:\n            raise ValueError(\"Method '*' cannot be mixed with other HTTP methods.\")\n\n        # Validate each method\n        validated_methods = []\n        for method in v:\n            method_str = str(method).upper().strip() if method != \"*\" else \"*\"\n            try:\n                validated_methods.append(HTTPMethod(method_str))\n            except ValueError as exc:\n                valid_methods = [m.value for m in HTTPMethod]\n                raise ValueError(\n                    f\"Invalid HTTP method '{method}'. Valid methods: {', '.join(valid_methods)}\"\n                ) from exc\n\n        # Remove duplicates while preserving order\n        seen = set()\n        unique_methods = []\n        for method in validated_methods:\n            if method not in seen:\n                seen.add(method)\n                unique_methods.append(method)\n\n        return unique_methods if unique_methods else None\n\n    @model_validator(mode=\"after\")\n    def validate_config_consistency(self) -> \"MCPConfigModel\":\n        \"\"\"Validate overall configuration consistency.\"\"\"\n        # If expose is False, other configurations don't matter much, but we still validate them\n        if self.expose is False:","sourceCodeStart":171,"sourceCodeEnd":207,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/extensions/mcp_server/openbb_mcp_server/models/mcp_config.py#L171-L207","documentation":"Raised when an entry in mcp_config.methods (after upper-casing and stripping) is not a member of the HTTPMethod enum. The message lists the accepted method names taken from the enum, so it doubles as documentation of the allowed set (standard HTTP verbs such as GET, POST, PUT, PATCH, DELETE, OPTIONS, HEAD, plus '*').","triggerScenarios":"\"methods\": [\"FETCH\"] or [\"get-json\"] — 'get-json'.upper() = 'GET-JSON' is not a valid enum value and raises. Also typos like 'PSOT', lowercase-with-suffix values, or vendor-specific pseudo-methods. The original enum ValueError is chained as the cause.","commonSituations":"Typos in hand-written YAML/JSON configs, method names copied from an RPC/GraphQL schema that are not HTTP verbs, version drift if a newer enum drops or adds a member while the config was written against a different version.","solutions":["Fix the method name to a standard HTTP verb, e.g. \"methods\": [\"GET\", \"POST\"]","Copy the exact valid list from the error message itself (it enumerates HTTPMethod values)","If you intended 'any method', use \"methods\": [\"*\"] instead of inventing a name"],"exampleFix":"# before\nopenapi_extra={\"mcp_config\": {\"methods\": [\"FETCH\"]}}\n\n# after\nopenapi_extra={\"mcp_config\": {\"methods\": [\"GET\"]}}","handlingStrategy":"validation","validationCode":"from openbb_mcp_server.models.mcp_config import HTTPMethod\n\nmethods = cfg.get(\"methods\")\nfor m in methods or []:\n    candidate = m if m == \"*\" else str(m).upper().strip()\n    if candidate != \"*\":\n        HTTPMethod(candidate)  # raises early with a clear traceback if invalid","typeGuard":"def are_valid_http_methods(methods: list[str]) -> bool:\n    valid = {m.value for m in HTTPMethod} | {\"*\"}\n    return all(\n        (m if m == \"*\" else m.upper().strip()) in valid for m in methods\n    )","tryCatchPattern":"try:\n    model = validate_mcp_config(cfg)\nexcept ValidationError as e:\n    if \"Invalid HTTP method\" in str(e):\n        valid = [m.value for m in HTTPMethod]\n        cfg[\"methods\"] = [m for m in cfg[\"methods\"] if m.upper() in valid]\n        model = validate_mcp_config(cfg)\n    else:\n        raise","preventionTips":["Uppercase method names in generated configs to match the enum","Use the error message's valid-methods list when fixing configs","Consider a JSON schema with enum: [GET, POST, ...] for config files"],"tags":["pydantic","validation","mcp","http","config","typo"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}