OpenBB-finance/OpenBB · error · ValueError
Either symbol or cik must be provided.
Error message
Either symbol or cik must be provided.
What it means
FMP company filings fetcher builds a URL from either query.symbol or query.cik; if neither is set the URL stays empty and it raises ValueError('Either symbol or cik must be provided.'). This is a client-side required-argument check that fires before any request, because the QueryParams model leaves both fields optional to accommodate either identifier.
Source
Thrown at openbb_platform/providers/fmp/openbb_fmp/models/company_filings.py:106
credentials: dict[str, str] | None,
**kwargs: Any,
) -> list[dict]:
"""Return the raw data from the FMP endpoint."""
# pylint: disable=import-outside-toplevel
from openbb_fmp.utils.helpers import get_data_many
api_key = credentials.get("fmp_api_key") if credentials else ""
base_url = "https://financialmodelingprep.com/stable/sec-filings-search"
url: str = ""
if query.symbol and not query.cik:
url = base_url + f"/symbol?symbol={query.symbol}"
elif query.cik:
url = base_url + f"/cik?cik={query.cik}"
if not url:
raise ValueError("Either symbol or cik must be provided.")
start_date = (
query.start_date
if query.start_date
else dateType.today() - timedelta(days=360)
)
url += f"&from={start_date}"
end_date = query.end_date if query.end_date else dateType.today()
url += f"&to={end_date}"
url += f"&page={query.page}&limit={query.limit}&apikey={api_key}"
return await get_data_many(url, **kwargs)
@staticmethod
def transform_data(
query: FMPCompanyFilingsQueryParams, data: list[dict], **kwargs: Any
) -> list[FMPCompanyFilingsData]:
"""Return the transformed data."""View on GitHub (pinned to 3e071fcc2c)
Solutions
- Pass a ticker symbol or a CIK (either format works) in the query params
- Add an upstream check that at least one identifier is truthy before calling
- Use a proper None default instead of empty-string sentinels for cik
Example fix
# before q = FMPCompanyFilingsQueryParams() # neither symbol nor cik -> ValueError # after q = FMPCompanyFilingsQueryParams(symbol="AAPL") # or q = FMPCompanyFilingsQueryParams(cik="0000320193")
Defensive patterns
Strategy: validation
Validate before calling
if not (query.symbol or query.cik):
raise ValueError("Provide either symbol or cik for FMP company filings") Type guard
def has_filings_identifier(q) -> bool:
return bool(getattr(q, "symbol", None) or getattr(q, "cik", None)) Prevention
- Always pass one of symbol/cik; do not rely on both-optional defaults
- Avoid empty-string/0 sentinels for 'missing' — use None
- Catch ValueError from construction as a programming bug, not a runtime retry
When it happens
Trigger: Constructing FMPCompanyFilingsQueryParams() with no arguments; passing symbol='' and cik=None (or 0) so both branches are falsy; code that conditionally sets one field but the branch never executes.
Common situations: Generic wrappers that forward optional kwargs and end up sending neither; cik passed as an int 0 or empty string as a 'missing' sentinel.
Related errors
- Required field missing -> symbol
- No data found for the given query -> {query.model_dump()}
- At least one extension type must be selected.
- Incorrect email or password
- Charting is not installed. Please install `openbb-charting`.
AI-assisted analysis of OpenBB-finance/OpenBB@3e071fcc2c (2026-08-14).
Data as JSON: /api/errors/1675e4b5357cb63f.
Report an issue: GitHub.