{"record":{"id":"de54d41db91defb5","repo":"PrefectHQ/fastmcp","slug":"error-rendering-prompt-name-r-e","errorCode":null,"errorMessage":"Error rendering prompt {name!r}: {e}","messagePattern":"Error rendering prompt (.+?): (.+?)","errorType":"exception","errorClass":"PromptError","httpStatus":null,"severity":"error","filePath":"fastmcp_slim/fastmcp/server/server.py","lineNumber":1793,"sourceCode":"                prompt = await self.get_prompt(name, version=version)\n                if prompt is None:\n                    raise NotFoundError(f\"Unknown prompt: {name!r}\")\n                span.set_attributes(prompt.get_span_attributes())\n                try:\n                    return await prompt._render(arguments)\n                except FastMCPError as e:\n                    logger.log(\n                        e.log_level, f\"Error rendering prompt {name!r}\", exc_info=True\n                    )\n                    raise\n                except MCPError:\n                    logger.exception(f\"Error rendering prompt {name!r}\")\n                    raise\n                except Exception as e:\n                    logger.exception(f\"Error rendering prompt {name!r}\")\n                    if self._mask_error_details:\n                        raise PromptError(f\"Error rendering prompt {name!r}\") from e\n                    raise PromptError(f\"Error rendering prompt {name!r}: {e}\") from e\n\n    def add_tool(self, tool: Tool | Callable[..., Any]) -> Tool:\n        \"\"\"Add a tool to the server.\n\n        The tool function can optionally request a Context object by adding a parameter\n        with the Context type annotation. See the @tool decorator for examples.\n\n        Args:\n            tool: The Tool instance or @tool-decorated function to register\n\n        Returns:\n            The tool instance that was added to the server.\n        \"\"\"\n        return self._local_provider.add_tool(tool)\n\n    @overload\n    def tool(\n        self,","sourceCodeStart":1775,"sourceCodeEnd":1811,"githubUrl":"https://github.com/PrefectHQ/fastmcp/blob/1f021142978e0861cd910c8df4e8074bc7cf3978/fastmcp_slim/fastmcp/server/server.py#L1775-L1811","documentation":"The detail-preserving variant of the prompt rendering failure: when self._mask_error_details is False, FastMCP converts the underlying exception to PromptError whose message appends the original error text (': {e}'), preserving diagnostic detail while still normalizing the type.","triggerScenarios":"server.get_prompt()/render_prompt() where the prompt function raises a non-MCP Exception and mask_error_details is False.","commonSituations":"Development/staging servers where error details are intentionally exposed; misconfigured prompt arguments producing ValueError/KeyError inside the render function.","solutions":["Inspect the ': {e}' suffix — it contains the original error; fix that root cause","Correct the arguments passed to get_prompt","Add validation or explicit PromptError raising inside the prompt function"],"exampleFix":"// before\nawait mcp.get_prompt(\"summary\", {\"doc\": None})  # NoneType error in render\n// after\nawait mcp.get_prompt(\"summary\", {\"doc\": open(\"report.md\").read()})","handlingStrategy":"try-catch","validationCode":"assert all(k in arguments for k in prompt_fn_signature_params)","typeGuard":null,"tryCatchPattern":"try:\n    prompt = await mcp.get_prompt(name, arguments)\nexcept PromptError as e:\n    print(e)  # message includes original ': {e}' detail","preventionTips":["Parse the ': {e}' suffix for the root cause","Type-check arguments against the prompt function signature","Add input validation inside prompt functions"],"tags":["python","prompts","server"],"backgroundTag":"prompt-render-failed","analyzedSha":"1f021142978e0861cd910c8df4e8074bc7cf3978","analyzedAt":"2026-08-29T14:31:16.082Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}