OpenBB-finance/OpenBB · error · ValueError
Required field missing -> symbol
Error message
Required field missing -> symbol
What it means
FMP company news QueryParams has a mode='before' validator on `symbol` that raises ValueError('Required field missing -> symbol') when the value is falsy. Unlike the shared NewsQueryParams where symbol may be optional, FMP's endpoint requires at least one ticker. Fires at model construction, before any request.
Source
Thrown at openbb_platform/providers/fmp/openbb_fmp/models/company_news.py:38
__json_schema_extra__ = {"symbol": {"multiple_items_allowed": True}}
page: int = Field(
default=0,
le=100,
ge=0,
description="Page number of the results. Use in combination with limit.",
)
press_release: bool | None = Field(
default=None,
description="When true, will return only press releases for the given symbol(s).",
)
@field_validator("symbol", mode="before", check_fields=False)
@classmethod
def _symbol_mandatory(cls, v):
"""Symbol mandatory validator."""
if not v:
raise ValueError("Required field missing -> symbol")
return v
class FMPCompanyNewsData(CompanyNewsData):
"""FMP Company News Data."""
__alias_dict__ = {
"symbols": "symbol",
"date": "publishedDate",
"author": "publisher",
"images": "image",
"source": "site",
"excerpt": "text",
}
source: str = Field(description="Name of the news site.")
View on GitHub (pinned to 3e071fcc2c)
Solutions
- Always supply at least one ticker (comma-separated string for multiple)
- Guard callers: skip the FMP news call when your symbol source is empty
- Use a provider that supports symbol-less news if you need market-wide headlines
Example fix
# before q = FMPCompanyNewsQueryParams() # ValueError: Required field missing -> symbol # after q = FMPCompanyNewsQueryParams(symbol="AAPL") # multiple: FMPCompanyNewsQueryParams(symbol="AAPL,MSFT")
Defensive patterns
Strategy: validation
Validate before calling
if not symbol or not symbol.strip():
raise ValueError("FMP company news requires at least one ticker") Type guard
def has_news_symbol(v) -> bool:
return bool(v) and bool(str(v).strip()) Prevention
- Skip the FMP news call entirely when your symbol source is empty
- Remember FMP news is per-symbol; use another provider for market-wide headlines
- Catch the construction-time ValueError as an input bug
When it happens
Trigger: Instantiating FMPCompanyNewsQueryParams() with no symbol; passing symbol='' or None; passing a list/iterable that evaluates falsy (empty list).
Common situations: Generic news code paths that omit symbol to fetch 'all news' — FMP does not support that; templated calls where the symbol variable is unset; passing an empty watchlist.
Related errors
- Either symbol or cik must be provided.
- At least one extension type must be selected.
- Incorrect email or password
- Charting is not installed. Please install `openbb-charting`.
- Invalid command : route={route}
AI-assisted analysis of OpenBB-finance/OpenBB@3e071fcc2c (2026-08-14).
Data as JSON: /api/errors/b834c4281542d88e.
Report an issue: GitHub.