{"record":{"id":"3964f1b11403bff5","repo":"OpenBB-finance/OpenBB","slug":"method-cannot-be-mixed-with-other-http-methods","errorCode":null,"errorMessage":"Method '*' cannot be mixed with other HTTP methods.","messagePattern":"Method '\\*' cannot be mixed with other HTTP methods\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"openbb_platform/extensions/mcp_server/openbb_mcp_server/models/mcp_config.py","lineNumber":179,"sourceCode":"    )\n\n    @field_validator(\"methods\", mode=\"before\")\n    @classmethod\n    def validate_methods(cls, v: str | list[str] | None) -> list[HTTPMethod] | None:\n        \"\"\"Normalize and validate HTTP methods.\"\"\"\n        if v is None:\n            return None\n\n        # Handle single string\n        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:","sourceCodeStart":161,"sourceCodeEnd":197,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/extensions/mcp_server/openbb_mcp_server/models/mcp_config.py#L161-L197","documentation":"Raised by the 'methods' validator when the wildcard '*' appears alongside other HTTP methods in the same mcp_config.methods list. '*' means 'all methods', so mixing it with explicit methods is ambiguous and rejected to keep route tool exposure deterministic.","triggerScenarios":"openapi_extra={\"mcp_config\": {\"methods\": [\"*\", \"GET\"]}} or [\"POST\", \"*\"]. Any list containing '*' with len > 1 triggers it, regardless of order or casing.","commonSituations":"Appending '*' to an existing per-method list 'to be safe', merging config fragments where one author used '*' and another enumerated methods, default templates that already list methods combined with a wildcard override.","solutions":["Use '*' alone: \"methods\": [\"*\"]","Or enumerate the concrete methods without '*': \"methods\": [\"GET\", \"POST\"]","If merging configs from multiple sources, drop '*' whenever the merged list has more than one entry"],"exampleFix":"# before\nopenapi_extra={\"mcp_config\": {\"methods\": [\"*\", \"GET\"]}}\n\n# after\nopenapi_extra={\"mcp_config\": {\"methods\": [\"*\"]}}","handlingStrategy":"validation","validationCode":"methods = cfg.get(\"methods\")\nif isinstance(methods, list) and \"*\" in methods and len(methods) > 1:\n    cfg[\"methods\"] = [\"*\"]  # wildcard wins, or drop it instead\n# also normalize case for comparison\nmethods = [m if m == \"*\" else m.upper() for m in (methods or [])]","typeGuard":"def methods_are_consistent(methods: list[str]) -> bool:\n    up = [m.upper() for m in methods]\n    return \"*\" not in up or len(up) == 1","tryCatchPattern":"try:\n    model = validate_mcp_config(cfg)\nexcept ValidationError as e:\n    if \"cannot be mixed\" in str(e):\n        cfg[\"methods\"] = [\"*\"]\n        model = validate_mcp_config(cfg)\n    else:\n        raise","preventionTips":["Pick one style per route: wildcard OR explicit enumeration","When merging configs, strip '*' if the merged list grows beyond one entry","Add a pre-flight assert: '*' not in methods or len(methods) == 1"],"tags":["pydantic","validation","mcp","http","config"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}