OpenBB-finance/OpenBB · error · ValueError
Method '*' cannot be mixed with other HTTP methods.
Error message
Method '*' cannot be mixed with other HTTP methods.
What it means
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.
Source
Thrown at openbb_platform/extensions/mcp_server/openbb_mcp_server/models/mcp_config.py:179
)
@field_validator("methods", mode="before")
@classmethod
def validate_methods(cls, v: str | list[str] | None) -> list[HTTPMethod] | None:
"""Normalize and validate HTTP methods."""
if v is None:
return None
# Handle single string
if isinstance(v, str):
v = [v]
if not isinstance(v, list):
raise ValueError("methods must be a list of strings")
# If '*' is present, it should be the only method
if "*" in v and len(v) > 1:
raise ValueError("Method '*' cannot be mixed with other HTTP methods.")
# Validate each method
validated_methods = []
for method in v:
method_str = str(method).upper().strip() if method != "*" else "*"
try:
validated_methods.append(HTTPMethod(method_str))
except ValueError as exc:
valid_methods = [m.value for m in HTTPMethod]
raise ValueError(
f"Invalid HTTP method '{method}'. Valid methods: {', '.join(valid_methods)}"
) from exc
# Remove duplicates while preserving order
seen = set()
unique_methods = []
for method in validated_methods:
if method not in seen:View on GitHub (pinned to 3e071fcc2c)
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
Example fix
# before
openapi_extra={"mcp_config": {"methods": ["*", "GET"]}}
# after
openapi_extra={"mcp_config": {"methods": ["*"]}} Defensive patterns
Strategy: validation
Validate before calling
methods = cfg.get("methods")
if isinstance(methods, list) and "*" in methods and len(methods) > 1:
cfg["methods"] = ["*"] # wildcard wins, or drop it instead
# also normalize case for comparison
methods = [m if m == "*" else m.upper() for m in (methods or [])] Type guard
def methods_are_consistent(methods: list[str]) -> bool:
up = [m.upper() for m in methods]
return "*" not in up or len(up) == 1 Try / catch
try:
model = validate_mcp_config(cfg)
except ValidationError as e:
if "cannot be mixed" in str(e):
cfg["methods"] = ["*"]
model = validate_mcp_config(cfg)
else:
raise Prevention
- 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
When it happens
Trigger: openapi_extra={"mcp_config": {"methods": ["*", "GET"]}} or ["POST", "*"]. Any list containing '*' with len > 1 triggers it, regardless of order or casing.
Common situations: 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.
Related errors
- methods must be a list of strings
- Invalid HTTP method '{method}'. Valid methods: {', '.join(va
- Tag cannot be empty string
- Duplicate prompt names found: {set(duplicates)}
- mcp_config must be a dictionary.
AI-assisted analysis of OpenBB-finance/OpenBB@3e071fcc2c (2026-08-14).
Data as JSON: /api/errors/3964f1b11403bff5.
Report an issue: GitHub.