{"record":{"id":"ee0fd4049c6b50a2","repo":"OpenBB-finance/OpenBB","slug":"prompt-content-cannot-be-empty","errorCode":null,"errorMessage":"Prompt content cannot be empty","messagePattern":"Prompt content cannot be empty","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"openbb_platform/extensions/mcp_server/openbb_mcp_server/models/mcp_config.py","lineNumber":106,"sourceCode":"        default=None, description=\"Name of the prompt (auto-generated if not provided)\"\n    )\n    description: str | None = Field(\n        default=None, description=\"Description of the prompt\"\n    )\n    content: str = Field(description=\"Template content with {variable} placeholders\")\n    arguments: list[ArgumentDefinitionModel] = Field(\n        default_factory=list, description=\"Argument definitions for the prompt\"\n    )\n    tags: list[str] = Field(\n        default_factory=list, description=\"Tags for categorizing the prompt\"\n    )\n\n    @field_validator(\"content\")\n    @classmethod\n    def validate_content(cls, v: str) -> str:\n        \"\"\"Validate content is not empty and contains valid template syntax.\"\"\"\n        if not v.strip():\n            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\")","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/extensions/mcp_server/openbb_mcp_server/models/mcp_config.py#L88-L124","documentation":"Pydantic validation error on PromptConfigModel.content: the prompt template is empty or only whitespace. Prompt content is the rendered message body sent to the model, so an empty template is meaningless and is rejected. It fires when a config entry has content: \"\", content: null coerced oddly, or a whitespace-only string.","triggerScenarios":"Loading an MCP prompt config whose content key is blank or missing text; YAML multiline scalars that collapse to empty (e.g. content: | with nothing indented under it); generators emitting prompts with unfilled templates.","commonSituations":"YAML indentation errors emptying a block scalar; templating pipelines producing '' for all entries; configs split across files with content defined in the wrong node.","solutions":["Provide non-empty prompt text under the content key.","For YAML block scalars, indent the template body under content: |.","If generating configs, skip or fail loudly when the rendered template is blank."],"exampleFix":"# before (content is empty)\nprompts:\n  - name: greet\n    content:\n\n# after\nprompts:\n  - name: greet\n    content: |\n      Summarize the following data: {data}","handlingStrategy":"validation","validationCode":"def validate_prompts(prompts: list[dict]) -> None:\n    for p in prompts:\n        if not str(p.get(\"content\", \"\")).strip():\n            raise ValueError(f\"prompt {p.get('name', '<unnamed>')} has empty content\")","typeGuard":"def has_nonempty_content(prompt_cfg: dict) -> bool:\n    return bool(str(prompt_cfg.get(\"content\", \"\")).strip())","tryCatchPattern":null,"preventionTips":["In YAML, indent template bodies under content: | block scalars.","Fail config generation loudly when a rendered template is blank.","Load configs through PromptConfigModel in CI to catch this early."],"tags":["openbb","mcp","pydantic","prompts","config-validation"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}