HKUDS/Vibe-Trading · error · HTTPException

{exc}

Error message

{exc}

What it means

_local_plugin_call requires overrides['connection_id'] — a non-empty, trimmed/lowercased id — before it can load credentials from the ConnectionStore for a local plugin call. Missing/blank connection_id raises ValueError immediately.

Source

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

                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:
                a = registry.get(aid)
            except KeyError:
                continue
            meta = a.meta or {}
            alphas.append(
                {
                    "id": a.id,
                    "zoo": a.zoo,
                    "theme": meta.get("theme", []),
                    "universe": meta.get("universe", []),
                    "nickname": meta.get("nickname"),
                    "decay_horizon": meta.get("decay_horizon"),

View on GitHub (pinned to 80ffdda44c)

Solutions

  1. Create a connection via ConnectionStore for the profile and pass overrides={'connection_id': '<id>'} on every call
  2. Verify the stored connection's profile_id matches the requested profile (the next check after this one)
  3. Audit call sites to ensure connection_id is propagated from user input/config for local-plugin profiles

Example fix

# before
account = get_account(profile)  # ValueError: requires a connection_id

# after
account = get_account(profile, overrides={"connection_id": "acme-main"})
Defensive patterns

Strategy: validation

Validate before calling

def has_connection_id(overrides: dict | None) -> bool:
    return bool(str((overrides or {}).get("connection_id") or "").strip())

Type guard

def overrides_ready_for_local_plugin(profile, overrides: dict) -> bool:
    if profile.transport != "local_plugin":
        return True
    cid = str((overrides or {}).get("connection_id") or "").strip()
    return bool(cid)

Try / catch

try:
    result = _local_plugin_call(profile, operation, overrides)
except ValueError as e:
    if "require a connection_id" in str(e):
        cid = prompt_or_load_connection_for(profile)  # create/select a connection
        result = _local_plugin_call(profile, operation, {**overrides, "connection_id": cid})
    else:
        raise

Prevention

When it happens

Trigger: Calling check_connection/get_account/get_positions/get_open_orders/get_quote/get_history for a local-plugin profile without passing connection_id in overrides; passing whitespace, None, or an id that lowercases to empty.

Common situations: CLI or automation code paths built for SDK profiles (no connection needed) reused against local plugins; connection_id stored under a different key or never created via the connections store; UI not forwarding the field.

Understand the failure class

Background: Missing required parameter errors: what 'X is required' and 'the required X param is missing' mean, and how to fix them — this error's family across 27 libraries.

Related errors


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