HKUDS/Vibe-Trading · error · HTTPException

unknown universe {universe!r}; expected one of {sorted(_VALI

Error message

unknown universe {universe!r}; expected one of {sorted(_VALID_UNIVERSES)}

What it means

The trading service maps broker_sdk connector keys to SDK module paths via _SDK_CONNECTOR_MODULES. _sdk_module raises ValueError when the connector key has no registered mapping, i.e. the built-in SDK doesn't support that broker.

Source

Thrown at agent/src/api/alpha_routes.py:405

        universe: str | None = Query(None, max_length=64),
        limit: int = Query(100, ge=1, le=1000),
    ) -> dict[str, Any]:
        """List alphas, optionally filtered by zoo / theme / universe."""
        if zoo is not None and zoo not in _VALID_ZOOS:
            raise HTTPException(
                status_code=400,
                detail=f"unknown zoo {zoo!r}; expected one of {sorted(_VALID_ZOOS)}",
            )
        if theme is not None and theme not in _VALID_THEMES:
            raise HTTPException(
                status_code=400,
                detail=f"unknown theme {theme!r}; expected one of {sorted(_VALID_THEMES)}",
            )
        if universe is not None:
            _ALIAS = {"csi300": "equity_cn", "sp500": "equity_us", "btc-usdt": "crypto"}
            universe = _ALIAS.get(universe, universe)
        if universe is not None and universe not in _VALID_UNIVERSES:
            raise HTTPException(
                status_code=400,
                detail=f"unknown universe {universe!r}; expected one of {sorted(_VALID_UNIVERSES)}",
            )

        from src.factors.registry import get_default_registry

        registry = get_default_registry()
        try:
            ids = registry.list(zoo=zoo, theme=theme, universe=universe)
        except Exception as exc:  # noqa: BLE001
            logger.exception("registry.list failed")
            raise HTTPException(status_code=500, detail=_safe_error(exc))

        total = len(ids)
        sliced = ids[:limit]
        alphas: list[dict[str, Any]] = []
        for aid in sliced:
            try:

View on GitHub (pinned to 80ffdda44c)

Solutions

  1. Check the _SDK_CONNECTOR_MODULES dict keys in service.py and correct the connector key in the profile to a supported one
  2. If the broker isn't supported by the SDK, use a local connector plugin instead
  3. Pin/align the agent version whose SDK module map matches the connector key you use

Example fix

# before: key not in map
profile = TradingProfile(connector="acme", transport="broker_sdk")

# after: use a registered connector key
profile = TradingProfile(connector="alpaca", transport="broker_sdk")
# or route via local plugin:
profile = TradingProfile(connector="acme", transport="local_plugin")
Defensive patterns

Strategy: validation

Validate before calling

from src.trading.service import _SDK_CONNECTOR_MODULES

def sdk_connector_supported(connector: str) -> bool:
    return connector in _SDK_CONNECTOR_MODULES

Type guard

def uses_supported_sdk_connector(profile) -> bool:
    from src.trading.service import _SDK_CONNECTOR_MODULES
    return profile.transport != "broker_sdk" or profile.connector in _SDK_CONNECTOR_MODULES

Try / catch

try:
    module = _sdk_module(connector)
except ValueError as e:
    if "no SDK connector module" in str(e):
        # fall back to a local plugin profile or surface supported keys
        supported = sorted(_SDK_CONNECTOR_MODULES)
        raise ValueError(f"unsupported connector {connector!r}; supported: {supported}") from e
    raise

Prevention

When it happens

Trigger: A profile using transport 'broker_sdk' with a connector key not present in _SDK_CONNECTOR_MODULES, then calling check_connection/get_account/get_positions/get_open_orders/get_quote/search_instruments which all resolve through _sdk_module.

Common situations: Typos in the connector key in a profile/config, upgrading the agent where an SDK connector was renamed or removed, or expecting a broker to be supported when its SDK integration doesn't exist.

Related errors


AI-assisted analysis of HKUDS/Vibe-Trading@80ffdda44c (2026-08-28). Data as JSON: /api/errors/8f98d89f86d8dd05. Report an issue: GitHub.