OpenBB-finance/OpenBB · error · ValueError
Argument name cannot be empty
Error message
Argument name cannot be empty
What it means
Pydantic field_validator error on ArgumentDefinitionModel: the 'name' field of an MCP prompt/tool argument definition was given an empty string. Argument names become template placeholders and keyword parameters, so an empty name is structurally invalid and is rejected at config-parse time before anything is constructed.
Source
Thrown at openbb_platform/extensions/mcp_server/openbb_mcp_server/models/mcp_config.py:55
class ArgumentDefinitionModel(BaseModel):
"""Model for validating prompt argument definitions."""
name: str = Field(..., description="Name of the argument")
type: str = Field(default="str", description="Type of the argument")
default: Any | None = Field(
default=None, description="Default value for the argument"
)
description: str | None = Field(
default=None, description="Description of the argument"
)
@field_validator("name")
@classmethod
def validate_name(cls, v: str) -> str:
"""Validate argument name is a valid identifier."""
if not v:
raise ValueError("Argument name cannot be empty")
if not re.match(r"^[a-zA-Z_][a-zA-Z0-9_]*$", v):
raise ValueError(f"Argument name '{v}' must be a valid Python identifier")
return v
@field_validator("type")
@classmethod
def validate_type(cls, v: str) -> str:
"""Validate type is a recognized type string."""
valid_types = {
"str",
"string",
"int",
"integer",
"float",
"bool",
"boolean",
"list",
"dict",View on GitHub (pinned to 3e071fcc2c)
Solutions
- Give every argument a non-empty name in the config file.
- Audit the arguments: list in your prompt config for empty entries and remove or fill them.
- If generating configs in code, assert name truthiness before building the model.
Example fix
# before (config.yaml)
arguments:
- name: ""
type: str
# after
arguments:
- name: symbol
type: str Defensive patterns
Strategy: validation
Validate before calling
def validate_arguments(args: list[dict]) -> None:
for a in args:
if not a.get("name"):
raise ValueError(f"argument with empty name: {a}") Type guard
import re
def has_valid_argument_names(args: list[dict]) -> bool:
return all(isinstance(a.get("name"), str) and re.match(r"^[a-zA-Z_][a-zA-Z0-9_]*$", a["name"]) for a in args) Prevention
- Lint MCP config files with a schema that requires non-empty argument names.
- In generators, skip emitting argument entries whose name is falsy.
- Test configs by loading MCPConfigModel before deploying.
When it happens
Trigger: Loading an MCP config (YAML/JSON) where an argument entry has name: "" or name: null serialized as empty; programmatically generating argument definitions with a missing-name bug; templates that default name to an empty string.
Common situations: Hand-written MCP prompt configs with placeholder arguments; config generators iterating empty lists; YAML indentation putting the name key on the wrong node.
Related errors
- Type '{v}' not recognized. Valid types: {', '.join(sorted(va
- Prompt content cannot be empty
- Tag must be a string, got {type(tag)}
- Argument name '{v}' must be a valid Python identifier
- Unmatched braces in prompt content: {open_braces} opening, {
AI-assisted analysis of OpenBB-finance/OpenBB@3e071fcc2c (2026-08-14).
Data as JSON: /api/errors/2e963c40dfb1a24b.
Report an issue: GitHub.