{"record":{"id":"23dc7a3f16939db2","repo":"OpenBB-finance/OpenBB","slug":"prompt-name-cannot-be-empty-string","errorCode":null,"errorMessage":"Prompt name cannot be empty string","messagePattern":"Prompt name cannot be empty string","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"openbb_platform/extensions/mcp_server/openbb_mcp_server/models/mcp_config.py","lineNumber":124,"sourceCode":"            raise ValueError(\"Prompt content cannot be empty\")\n\n        # Check for unmatched braces\n        open_braces = v.count(\"{\")\n        close_braces = v.count(\"}\")\n        if open_braces != close_braces:\n            raise ValueError(\n                f\"Unmatched braces in prompt content: {open_braces} opening, {close_braces} closing\"\n            )\n\n        return v\n\n    @field_validator(\"name\")\n    @classmethod\n    def validate_name(cls, v: str | None) -> str | None:\n        \"\"\"Validate prompt name if provided.\"\"\"\n        if v is not None:\n            if not v.strip():\n                raise ValueError(\"Prompt name cannot be empty string\")\n            # Check for valid identifier-like name\n            if not re.match(r\"^[a-zA-Z_][a-zA-Z0-9_]*$\", v.strip()):\n                raise ValueError(f\"Prompt name '{v}' should be a valid identifier\")\n        return v\n\n    @field_validator(\"tags\")\n    @classmethod\n    def validate_tags(cls, v: list[str]) -> list[str]:\n        \"\"\"Validate tags are non-empty strings.\"\"\"\n        validated_tags = []\n        for tag in v:\n            if not isinstance(tag, str):\n                raise ValueError(f\"Tag must be a string, got {type(tag)}\")\n            if not tag.strip():\n                raise ValueError(\"Tag cannot be empty string\")\n            validated_tags.append(tag.strip())\n        return validated_tags\n","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/extensions/mcp_server/openbb_mcp_server/models/mcp_config.py#L106-L142","documentation":"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.","triggerScenarios":"Config entries with name: \"\" or name: \"   \" after YAML/JSON editing; template systems emitting a whitespace placeholder when no name is set; trailing-space typos.","commonSituations":"Removing a name but leaving spaces in the config; generated configs where an f-string name renders to whitespace.","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."],"exampleFix":"# before\nprompts:\n  - name: \"   \"\n    content: \"Hello\"\n\n# after\nprompts:\n  - content: \"Hello\"  # name omitted -> auto-generated\n# or\nprompts:\n  - name: hello\n    content: \"Hello\"","handlingStrategy":"validation","validationCode":"def clean_prompt_name(name: str | None) -> str | None:\n    if name is None:\n        return None\n    name = name.strip()\n    return name or None  # whitespace-only -> omit and let server auto-generate","typeGuard":"def is_usable_prompt_name(name: str | None) -> bool:\n    return name is None or bool(name.strip())","tryCatchPattern":null,"preventionTips":["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."],"tags":["openbb","mcp","pydantic","prompts","naming"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}