OpenBB-finance/OpenBB · error · ValueError
Prompt name cannot be empty string
Error message
Prompt name cannot be empty string
What it means
Pydantic validation error on PromptConfigModel.name: an explicit name was provided but it is only whitespace (e.g. " "). Names are optional (auto-generated when None), but if present they must be non-empty; a whitespace-only string is treated as a mistake rather than a name.
Source
Thrown at openbb_platform/extensions/mcp_server/openbb_mcp_server/models/mcp_config.py:124
raise ValueError("Prompt content cannot be empty")
# Check for unmatched braces
open_braces = v.count("{")
close_braces = v.count("}")
if open_braces != close_braces:
raise ValueError(
f"Unmatched braces in prompt content: {open_braces} opening, {close_braces} closing"
)
return v
@field_validator("name")
@classmethod
def validate_name(cls, v: str | None) -> str | None:
"""Validate prompt name if provided."""
if v is not None:
if not v.strip():
raise ValueError("Prompt name cannot be empty string")
# Check for valid identifier-like name
if not re.match(r"^[a-zA-Z_][a-zA-Z0-9_]*$", v.strip()):
raise ValueError(f"Prompt name '{v}' should be a valid identifier")
return v
@field_validator("tags")
@classmethod
def validate_tags(cls, v: list[str]) -> list[str]:
"""Validate tags are non-empty strings."""
validated_tags = []
for tag in v:
if not isinstance(tag, str):
raise ValueError(f"Tag must be a string, got {type(tag)}")
if not tag.strip():
raise ValueError("Tag cannot be empty string")
validated_tags.append(tag.strip())
return validated_tags
View on GitHub (pinned to 3e071fcc2c)
Solutions
- Either delete the name key entirely (it will be auto-generated) or supply a real name.
- Trim whitespace from name values in the config.
- In generators, emit no name key when the computed name is blank.
Example fix
# before
prompts:
- name: " "
content: "Hello"
# after
prompts:
- content: "Hello" # name omitted -> auto-generated
# or
prompts:
- name: hello
content: "Hello" Defensive patterns
Strategy: validation
Validate before calling
def clean_prompt_name(name: str | None) -> str | None:
if name is None:
return None
name = name.strip()
return name or None # whitespace-only -> omit and let server auto-generate Type guard
def is_usable_prompt_name(name: str | None) -> bool:
return name is None or bool(name.strip()) Prevention
- Omit the name key entirely rather than leaving a blank value.
- Strip names in config generators; emit no key when blank.
- Validate configs by loading PromptConfigModel before shipping.
When it happens
Trigger: Config entries with name: "" or name: " " after YAML/JSON editing; template systems emitting a whitespace placeholder when no name is set; trailing-space typos.
Common situations: Removing a name but leaving spaces in the config; generated configs where an f-string name renders to whitespace.
Related errors
- Prompt name '{v}' should be a valid identifier
- Argument name '{v}' must be a valid Python identifier
- Prompt content cannot be empty
- Unmatched braces in prompt content: {open_braces} opening, {
- Argument name cannot be empty
AI-assisted analysis of OpenBB-finance/OpenBB@3e071fcc2c (2026-08-14).
Data as JSON: /api/errors/23dc7a3f16939db2.
Report an issue: GitHub.