{"record":{"id":"1675e4b5357cb63f","repo":"OpenBB-finance/OpenBB","slug":"either-symbol-or-cik-must-be-provided","errorCode":null,"errorMessage":"Either symbol or cik must be provided.","messagePattern":"Either symbol or cik must be provided\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"openbb_platform/providers/fmp/openbb_fmp/models/company_filings.py","lineNumber":106,"sourceCode":"        credentials: dict[str, str] | None,\n        **kwargs: Any,\n    ) -> list[dict]:\n        \"\"\"Return the raw data from the FMP endpoint.\"\"\"\n        # pylint: disable=import-outside-toplevel\n        from openbb_fmp.utils.helpers import get_data_many\n\n        api_key = credentials.get(\"fmp_api_key\") if credentials else \"\"\n\n        base_url = \"https://financialmodelingprep.com/stable/sec-filings-search\"\n        url: str = \"\"\n\n        if query.symbol and not query.cik:\n            url = base_url + f\"/symbol?symbol={query.symbol}\"\n        elif query.cik:\n            url = base_url + f\"/cik?cik={query.cik}\"\n\n        if not url:\n            raise ValueError(\"Either symbol or cik must be provided.\")\n\n        start_date = (\n            query.start_date\n            if query.start_date\n            else dateType.today() - timedelta(days=360)\n        )\n        url += f\"&from={start_date}\"\n        end_date = query.end_date if query.end_date else dateType.today()\n        url += f\"&to={end_date}\"\n        url += f\"&page={query.page}&limit={query.limit}&apikey={api_key}\"\n\n        return await get_data_many(url, **kwargs)\n\n    @staticmethod\n    def transform_data(\n        query: FMPCompanyFilingsQueryParams, data: list[dict], **kwargs: Any\n    ) -> list[FMPCompanyFilingsData]:\n        \"\"\"Return the transformed data.\"\"\"","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/fmp/openbb_fmp/models/company_filings.py#L88-L124","documentation":"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.","triggerScenarios":"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.","commonSituations":"Generic wrappers that forward optional kwargs and end up sending neither; cik passed as an int 0 or empty string as a 'missing' sentinel.","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"],"exampleFix":"# before\nq = FMPCompanyFilingsQueryParams()  # neither symbol nor cik -> ValueError\n\n# after\nq = FMPCompanyFilingsQueryParams(symbol=\"AAPL\")\n# or\nq = FMPCompanyFilingsQueryParams(cik=\"0000320193\")","handlingStrategy":"validation","validationCode":"if not (query.symbol or query.cik):\n    raise ValueError(\"Provide either symbol or cik for FMP company filings\")","typeGuard":"def has_filings_identifier(q) -> bool:\n    return bool(getattr(q, \"symbol\", None) or getattr(q, \"cik\", None))","tryCatchPattern":null,"preventionTips":["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"],"tags":["openbb","fmp","validation","required-field","filings"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}