OpenBB-finance/OpenBB · error · ValueError

Type '{v}' not recognized. Valid types: {', '.join(sorted(va

Error message

Type '{v}' not recognized. Valid types: {', '.join(sorted(valid_types))}

What it means

Pydantic validation error on ArgumentDefinitionModel.type: the type string is not in the recognized set {str, string, int, integer, float, bool, boolean, list, dict, any, Any}. Types are declared as strings in MCP configs, so typos or unsupported types (e.g. 'number', 'array', 'datetime') are caught here at load time; the message lists the sorted valid options.

Source

Thrown at openbb_platform/extensions/mcp_server/openbb_mcp_server/models/mcp_config.py:78

    @field_validator("type")
    @classmethod
    def validate_type(cls, v: str) -> str:
        """Validate type is a recognized type string."""
        valid_types = {
            "str",
            "string",
            "int",
            "integer",
            "float",
            "bool",
            "boolean",
            "list",
            "dict",
            "any",
            "Any",
        }
        if v not in valid_types:
            raise ValueError(
                f"Type '{v}' not recognized. Valid types: {', '.join(sorted(valid_types))}"
            )
        return v


class PromptConfigModel(BaseModel):
    """Model for validating individual prompt configurations."""

    name: str | None = Field(
        default=None, description="Name of the prompt (auto-generated if not provided)"
    )
    description: str | None = Field(
        default=None, description="Description of the prompt"
    )
    content: str = Field(description="Template content with {variable} placeholders")
    arguments: list[ArgumentDefinitionModel] = Field(
        default_factory=list, description="Argument definitions for the prompt"
    )

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Map JSON-Schema types: number → float, array → list, object → dict, integer → int.
  2. Use one of the exact strings from the error's valid-types list, respecting case for 'Any'.
  3. For unknown shapes use 'any'.

Example fix

# before
arguments:
  - name: limit
    type: number

# after
arguments:
  - name: limit
    type: float
Defensive patterns

Strategy: validation

Validate before calling

VALID_TYPES = {"str", "string", "int", "integer", "float", "bool", "boolean", "list", "dict", "any", "Any"}
JSON_SCHEMA_MAP = {"number": "float", "array": "list", "object": "dict"}

def coerce_type(t: str) -> str:
    return JSON_SCHEMA_MAP.get(t, t) if t in VALID_TYPES or t in JSON_SCHEMA_MAP else (_ for _ in ()).throw(ValueError(f"bad type {t}"))

Type guard

def is_recognized_type(t: str) -> bool:
    return t in {"str", "string", "int", "integer", "float", "bool", "boolean", "list", "dict", "any", "Any"}

Prevention

When it happens

Trigger: Writing type: number or type: array (JSON-Schema style) in an MCP config; type: datetime or other Python types not in the whitelist; case variants like 'String' or 'INT' which are not accepted.

Common situations: Porting JSON-Schema or OpenAPI parameter types directly; authors assuming any Python type name works; case-sensitivity surprises ('Any' is valid but 'any' also is, while 'string' works and 'String' does not).

Related errors


AI-assisted analysis of OpenBB-finance/OpenBB@3e071fcc2c (2026-08-14). Data as JSON: /api/errors/193ad8969fb4e1bd. Report an issue: GitHub.