OpenBB-finance/OpenBB · error · ValueError

Invalid document type. Must be one of: {', '.join(choice_typ

Error message

Invalid document type. Must be one of: {', '.join(choice_types)}

What it means

Raised by a pydantic field_validator on FederalReserveFomcDocumentsQueryParams when document_type is non-null and not in choice_types (the FOMC document categories: agenda, minutes, statement, press_conference, etc.). Validation happens at query-model construction, before any fetch.

Source

Thrown at openbb_platform/providers/federal_reserve/openbb_federal_reserve/models/fomc_documents.py:80

            }
        },
    }

    year: int | None = Field(
        default=None,
        description="The year of FOMC documents to retrieve. If None, all years since 1959 are returned.",
    )
    document_type: str | None = Field(
        default=None,
        description=f"Filter by document type. Default is all. Choose from: {', '.join(choice_types)}",
    )

    @field_validator("document_type", mode="before", check_fields=False)
    @classmethod
    def _validate_doc_type(cls, v):
        """Validate document type."""
        if v and v not in choice_types:
            raise ValueError(
                f"Invalid document type. Must be one of: {', '.join(choice_types)}"
            )
        return v


class FederalReserveFomcDocumentsData(Data):
    """Federal Reserve FOMC Documents Data."""

    model_config = ConfigDict(
        json_schema_extra={
            "x-widget_config": {
                "$.type": "multi_file_viewer",
                "$.name": "FOMC PDF Document Viewer",
                "$.description": "Current and historical FOMC PDF materials.",
                "$.gridData": {
                    "w": 30,
                    "h": 27,
                },

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Read the choice_types list at the top of openbb_federal_reserve/models/fomc_documents.py and use an exact token.
  2. Leave document_type as None to fetch all types, then filter client-side by the returned type field.
  3. Use the token exactly as exposed in the endpoint's OpenAPI choices.

Example fix

// before
obb.economy.fomc_documents(document_type='Minutes')

// after
obb.economy.fomc_documents(document_type='minutes')
Defensive patterns

Strategy: validation

Validate before calling

from openbb_federal_reserve.models.fomc_documents import choice_types
if document_type and document_type not in choice_types:
    raise ValueError(f'document_type must be one of {choice_types}')

Type guard

def is_valid_fomc_doc_type(t: str) -> bool:
    from openbb_federal_reserve.models.fomc_documents import choice_types
    return t in choice_types

Prevention

When it happens

Trigger: Calling obb.economy.fed.fomc_documents (or the federal_reserve fomc_documents model) with document_type='minutes_pdf', 'Minutes' (wrong form), or another unsupported token.

Common situations: Guessing document type names; using display labels ('Press Conference') instead of the snake_case tokens; version drift if choice_types gained/lost entries.

Related errors


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