ZhuLinsen/daily_stock_analysis · error · ValueError

validation_error

validation_error

Error message

broker must be one of: {supported}

What it means

Error "broker must be one of: {supported}" thrown in ZhuLinsen/daily_stock_analysis.

Source

Thrown at src/services/portfolio_import_service.py:277

                failed_count += 1
                errors.append(f"idx={i}: {exc}")

        return {
            "account_id": account_id,
            "record_count": len(records),
            "inserted_count": inserted_count,
            "duplicate_count": duplicate_count,
            "failed_count": failed_count,
            "dry_run": bool(dry_run),
            "errors": errors[:20],
        }

    def _normalize_broker(self, value: str) -> str:
        broker = (value or "").strip().lower()
        broker = self._broker_alias_map.get(broker, broker)
        if broker not in self._parser_registry:
            supported = ", ".join(sorted(self._parser_registry.keys()))
            raise ValueError(f"broker must be one of: {supported}")
        return broker

    @staticmethod
    def _read_csv(content: bytes) -> pd.DataFrame:
        for encoding in ("utf-8-sig", "gbk", "gb18030"):
            try:
                return pd.read_csv(
                    io.BytesIO(content),
                    encoding=encoding,
                    dtype=str,
                    keep_default_na=False,
                )
            except UnicodeDecodeError:
                continue
        return pd.read_csv(io.BytesIO(content), dtype=str, keep_default_na=False)

    def _normalize_trade_row(
        self,

View on GitHub (pinned to 5159bd72e8)

Solutions

  1. Use one of the supported broker identifiers listed in the error.
  2. Check the import request/config for a typo in the broker name.
  3. If the broker should be supported, add its adapter to the import service first.

When it happens

Trigger: Thrown at src/services/portfolio_import_service.py:277 when the library encounters an invalid state.

Common situations: Raised when importing a portfolio for an unsupported broker; occurs when the broker parameter is not one of the supported import adapters.


AI-assisted analysis of ZhuLinsen/daily_stock_analysis@5159bd72e8 (2026-08-15). Data as JSON: /api/errors/5f5942f4258f8320. Report an issue: GitHub.