{"record":{"id":"0966e2931a7ffe42","repo":"PrefectHQ/fastmcp","slug":"unknown-format-format","errorCode":null,"errorMessage":"Unknown format: {format}","messagePattern":"Unknown format: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"fastmcp_slim/fastmcp/utilities/inspect.py","lineNumber":532,"sourceCode":"\n    Returns:\n        JSON bytes in the requested format\n    \"\"\"\n    # Convert string to enum if needed\n    if isinstance(format, str):\n        format = InspectFormat(format)\n\n    if format == InspectFormat.MCP:\n        # MCP format doesn't need FastMCPInfo, it uses Client directly\n        return await format_mcp_info(mcp)\n    elif format == InspectFormat.FASTMCP:\n        # For FastMCP format, we need the FastMCPInfo\n        # This works for both v1 and v2 servers\n        if info is None:\n            info = await inspect_fastmcp(mcp)\n        return format_fastmcp_info(info)\n    else:\n        raise ValueError(f\"Unknown format: {format}\")\n","sourceCodeStart":514,"sourceCodeEnd":533,"githubUrl":"https://github.com/PrefectHQ/fastmcp/blob/1f021142978e0861cd910c8df4e8074bc7cf3978/fastmcp_slim/fastmcp/utilities/inspect.py#L514-L533","documentation":"`format_info` only supports the formats accepted by the `inspect` utility (e.g. 'mcp' and 'fastmcp'); any other string falls through the if/elif chain to a ValueError. It is a fail-fast guard against misspelled or unsupported output format arguments.","triggerScenarios":"Calling `format_info(mcp, format='json')`, `format='yaml'`, or a typo like `format='fastMcp'` instead of a supported format string.","commonSituations":"Building CLI flags or config that pass user-provided format names straight into `format_info`; case-sensitivity mistakes ('FastMCP' vs 'fastmcp').","solutions":["Pass a supported format value ('mcp' or 'fastmcp' — check the inspect utility's accepted set).","Normalize/validate user input against the allowed formats before calling.","Add explicit handling for the desired format upstream if a new output style is needed."],"exampleFix":"// before\ninfo = await format_info(mcp, fmt='json')\n// after\ninfo = await format_info(mcp, format='fastmcp')","handlingStrategy":"validation","validationCode":"SUPPORTED_FORMATS = {'mcp', 'fastmcp'}\ndef check_format(fmt: str):\n    if fmt not in SUPPORTED_FORMATS:\n        raise ValueError(f'format must be one of {sorted(SUPPORTED_FORMATS)}, got {fmt!r}')","typeGuard":"from typing import Literal\nFormat = Literal['mcp', 'fastmcp']\ndef is_valid_format(fmt: str) -> TypeGuard[Format]:\n    return fmt in ('mcp', 'fastmcp')","tryCatchPattern":"try:\n    info = await format_info(mcp, format=fmt)\nexcept ValueError:\n    info = await format_info(mcp, format='mcp')","preventionTips":["Validate CLI/config format options against an allowed set","Normalize case before passing user input ('fastMCP' -> 'fastmcp')","Use a Literal/enum type for the format parameter"],"tags":["fastmcp","validation","bad-argument","inspect"],"backgroundTag":"invalid-argument-value","analyzedSha":"1f021142978e0861cd910c8df4e8074bc7cf3978","analyzedAt":"2026-08-29T14:31:16.082Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}