{"record":{"id":"74f96e170334ff49","repo":"OpenBB-finance/OpenBB","slug":"missing-required-arguments-missing","errorCode":null,"errorMessage":"Missing required arguments: {missing}","messagePattern":"Missing required arguments: (.+?)","errorType":"exception","errorClass":"PromptError","httpStatus":null,"severity":"error","filePath":"openbb_platform/extensions/mcp_server/openbb_mcp_server/models/prompts.py","lineNumber":30,"sourceCode":"\n    content: str\n    argument_defaults: dict[str, Any] = {}\n\n    async def render(\n        self,\n        arguments: dict[str, Any] | None = None,\n    ) -> list[PromptMessage]:\n        \"\"\"Render the prompt with arguments.\"\"\"\n        # Start with stored defaults, then overlay caller-supplied values\n        args = {**self.argument_defaults, **(arguments or {})}\n\n        # Validate required arguments\n        if self.arguments:\n            required = {arg.name for arg in self.arguments if arg.required}\n            provided = set(args)\n            missing = required - provided\n            if missing:\n                raise PromptError(f\"Missing required arguments: {missing}\")\n\n        try:\n            rendered_content = (\n                self.content.format(**args) if self.arguments or args else self.content\n            )\n            return [\n                PromptMessage(\n                    role=\"user\", content=TextContent(type=\"text\", text=rendered_content)\n                )\n            ]\n        except KeyError as e:\n            raise PromptError(f\"Missing argument for formatting: {e}\") from e\n","sourceCodeStart":12,"sourceCodeEnd":43,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/extensions/mcp_server/openbb_mcp_server/models/prompts.py#L12-L43","documentation":"Thrown by Prompt.render (as PromptError) when a prompt declares required arguments but the caller did not supply all of them. Defaults stored in argument_defaults are applied first, then the caller's arguments; the check compares the union of both against the names of arguments flagged required=True.","triggerScenarios":"A prompt declares arguments=[{name: \"ticker\", required: True}] and the client calls render(arguments={}) or only passes another optional argument. Also when the argument key is misspelled (\"ticke\") so the required \"ticker\" is still missing.","commonSituations":"MCP clients omitting optional-looking parameters, schema drift after a prompt gains a new required argument, spelling/case mismatches between client-supplied keys and declared argument names (matching is exact, not case-insensitive).","solutions":["Pass every required argument by its exact declared name: prompt.render(arguments={\"ticker\": \"AAPL\"})","Set a default in the prompt definition (argument_defaults={\"ticker\": \"AAPL\"}) or mark the argument required: False if it is genuinely optional","Inspect prompt.arguments (name/required fields) before rendering to build the call dynamically"],"exampleFix":"# before\nmessages = prompt.render(arguments={\"period\": \"1y\"})  # ticker missing\n\n# after\nmessages = prompt.render(arguments={\"ticker\": \"AAPL\", \"period\": \"1y\"})","handlingStrategy":"validation","validationCode":"required = {\n    a.name for a in (prompt.arguments or []) if a.required\n}\nprovided = {**prompt.argument_defaults, **(arguments or {})}\nmissing = required - provided.keys()\nif missing:\n    raise ValueError(f\"supply values for: {missing}\")\nmessages = prompt.render(arguments=arguments)","typeGuard":"def can_render(prompt, arguments: dict | None) -> bool:\n    required = {a.name for a in (prompt.arguments or []) if a.required}\n    have = {**prompt.argument_defaults, **(arguments or {})}\n    return required <= have.keys()","tryCatchPattern":"from openbb_mcp_server.models.prompts import PromptError\n\ntry:\n    messages = prompt.render(arguments=args)\nexcept PromptError as e:\n    if \"Missing required arguments\" in str(e):\n        args.update({name: default_for(name) for name in extract_missing(str(e))})\n        messages = prompt.render(arguments=args)\n    else:\n        raise","preventionTips":["Build the arguments dict from prompt.arguments metadata so nothing is omitted","Give required arguments sensible argument_defaults when authoring prompts","Match key names exactly — the check is case- and spelling-sensitive"],"tags":["mcp","prompts","validation","arguments"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}