{"record":{"id":"5a41f00a48aa0e5b","repo":"OpenBB-finance/OpenBB","slug":"n-join-messages-5a41f0","errorCode":null,"errorMessage":"\\n\".join(messages)","messagePattern":"\\\\n\"\\.join\\(messages\\)","errorType":"exception","errorClass":"OpenBBError","httpStatus":null,"severity":"error","filePath":"openbb_platform/providers/finviz/openbb_finviz/models/price_target.py","lineNumber":116,"sourceCode":"                    price_targets[\"adj_price_target\"] == price_targets[\"price_target\"],\n                    \"price_target\",\n                ] = None\n                price_targets = price_targets.replace(\"\", None).drop(columns=\"Price\")\n            except Exception as e:  # pylint: disable=W0718\n                messages.append(f\"Failed to get data for {symbol} -> {e}\")\n                return result\n            result = price_targets.to_dict(orient=\"records\")\n            return result\n\n        symbols = query.symbol.split(\",\") if query.symbol else []\n\n        for symbol in symbols:\n            result = get_one(symbol)\n            if result:\n                results.extend(result)\n\n        if not results and messages:\n            raise OpenBBError(\"\\n\".join(messages))\n\n        if not results and not messages:\n            raise EmptyDataError(\"No data was returned for any symbol\")\n\n        if results and messages:\n            for message in messages:\n                warn(message)\n\n        return results\n\n    @staticmethod\n    def transform_data(\n        query: FinvizPriceTargetQueryParams,\n        data: list[dict],\n        **kwargs: Any,\n    ) -> list[FinvizPriceTargetData]:\n        \"\"\"Transform and validate the raw data.\"\"\"\n        return [FinvizPriceTargetData.model_validate(d) for d in data]","sourceCodeStart":98,"sourceCodeEnd":134,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/finviz/openbb_finviz/models/price_target.py#L98-L134","documentation":"Finviz price target fetcher mirrors the batch pattern: if every symbol's get_one recorded an error into `messages` and no rows were collected, it raises OpenBBError with all messages joined by newlines. Each message typically says which symbol had no price-target data or failed to fetch.","triggerScenarios":"Requesting price targets for symbols Finviz has no analyst coverage for (small caps, OTC); all symbols failing due to rate limiting recorded as messages.","commonSituations":"Screening pipelines that pull targets for newly listed tickers; batch jobs hitting Finviz rate limits so every request errors.","solutions":["Inspect the joined message lines to see per-symbol failure reasons","Filter the symbol list to tickers with analyst coverage before requesting","Add spacing/retry for rate-limit messages before giving up"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"symbols = [s.strip() for s in (query.symbol or \"\").split(\",\") if s.strip()]\nassert symbols, \"price target query needs at least one symbol\"","typeGuard":null,"tryCatchPattern":"from openbb_core.app.model.obb_error import OpenBBError\n\ntry:\n    results = await FinvizPriceTargetFetcher.transform_query(...)\nexcept OpenBBError as e:\n    bad = {ln.split()[-1] for ln in str(e).splitlines() if ln}\n    # retry without `bad`, or record as no-coverage","preventionTips":["Expect no price targets for tickers without analyst coverage","Respect Finviz rate limits when batching (space requests)","Log per-symbol messages for auditability"],"tags":["openbb","finviz","batch","price-target","symbol-validation"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}