OpenBB-finance/OpenBB · error · ValueError
Invalid HTTP method '{method}'. Valid methods: {', '.join(va
Error message
Invalid HTTP method '{method}'. Valid methods: {', '.join(valid_methods)} What it means
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 '*').
Source
Thrown at openbb_platform/extensions/mcp_server/openbb_mcp_server/models/mcp_config.py:189
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:
seen.add(method)
unique_methods.append(method)
return unique_methods if unique_methods else None
@model_validator(mode="after")
def validate_config_consistency(self) -> "MCPConfigModel":
"""Validate overall configuration consistency."""
# If expose is False, other configurations don't matter much, but we still validate them
if self.expose is False:View on GitHub (pinned to 3e071fcc2c)
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
Example fix
# before
openapi_extra={"mcp_config": {"methods": ["FETCH"]}}
# after
openapi_extra={"mcp_config": {"methods": ["GET"]}} Defensive patterns
Strategy: validation
Validate before calling
from openbb_mcp_server.models.mcp_config import HTTPMethod
methods = cfg.get("methods")
for m in methods or []:
candidate = m if m == "*" else str(m).upper().strip()
if candidate != "*":
HTTPMethod(candidate) # raises early with a clear traceback if invalid Type guard
def are_valid_http_methods(methods: list[str]) -> bool:
valid = {m.value for m in HTTPMethod} | {"*"}
return all(
(m if m == "*" else m.upper().strip()) in valid for m in methods
) Try / catch
try:
model = validate_mcp_config(cfg)
except ValidationError as e:
if "Invalid HTTP method" in str(e):
valid = [m.value for m in HTTPMethod]
cfg["methods"] = [m for m in cfg["methods"] if m.upper() in valid]
model = validate_mcp_config(cfg)
else:
raise Prevention
- 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
When it happens
Trigger: "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.
Common situations: 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.
Related errors
- methods must be a list of strings
- Method '*' cannot be mixed with other HTTP methods.
- 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/90e452f318cf1229.
Report an issue: GitHub.