{"record":{"id":"3909aa3433155f66","repo":"HKUDS/Vibe-Trading","slug":"exc","errorCode":null,"errorMessage":"{exc}","messagePattern":"\\{exc\\}","errorType":"http","errorClass":"HTTPException","httpStatus":500,"severity":"error","filePath":"agent/src/api/alpha_routes.py","lineNumber":417,"sourceCode":"                detail=f\"unknown theme {theme!r}; expected one of {sorted(_VALID_THEMES)}\",\n            )\n        if universe is not None:\n            _ALIAS = {\"csi300\": \"equity_cn\", \"sp500\": \"equity_us\", \"btc-usdt\": \"crypto\"}\n            universe = _ALIAS.get(universe, universe)\n        if universe is not None and universe not in _VALID_UNIVERSES:\n            raise HTTPException(\n                status_code=400,\n                detail=f\"unknown universe {universe!r}; expected one of {sorted(_VALID_UNIVERSES)}\",\n            )\n\n        from src.factors.registry import get_default_registry\n\n        registry = get_default_registry()\n        try:\n            ids = registry.list(zoo=zoo, theme=theme, universe=universe)\n        except Exception as exc:  # noqa: BLE001\n            logger.exception(\"registry.list failed\")\n            raise HTTPException(status_code=500, detail=_safe_error(exc))\n\n        total = len(ids)\n        sliced = ids[:limit]\n        alphas: list[dict[str, Any]] = []\n        for aid in sliced:\n            try:\n                a = registry.get(aid)\n            except KeyError:\n                continue\n            meta = a.meta or {}\n            alphas.append(\n                {\n                    \"id\": a.id,\n                    \"zoo\": a.zoo,\n                    \"theme\": meta.get(\"theme\", []),\n                    \"universe\": meta.get(\"universe\", []),\n                    \"nickname\": meta.get(\"nickname\"),\n                    \"decay_horizon\": meta.get(\"decay_horizon\"),","sourceCodeStart":399,"sourceCodeEnd":435,"githubUrl":"https://github.com/HKUDS/Vibe-Trading/blob/80ffdda44c5c4db0dd84d70e051cca591cea67df/agent/src/api/alpha_routes.py#L399-L435","documentation":"_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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Create a connection via ConnectionStore for the profile and pass overrides={'connection_id': '<id>'} on every call","Verify the stored connection's profile_id matches the requested profile (the next check after this one)","Audit call sites to ensure connection_id is propagated from user input/config for local-plugin profiles"],"exampleFix":"# before\naccount = get_account(profile)  # ValueError: requires a connection_id\n\n# after\naccount = get_account(profile, overrides={\"connection_id\": \"acme-main\"})","handlingStrategy":"validation","validationCode":"def has_connection_id(overrides: dict | None) -> bool:\n    return bool(str((overrides or {}).get(\"connection_id\") or \"\").strip())","typeGuard":"def overrides_ready_for_local_plugin(profile, overrides: dict) -> bool:\n    if profile.transport != \"local_plugin\":\n        return True\n    cid = str((overrides or {}).get(\"connection_id\") or \"\").strip()\n    return bool(cid)","tryCatchPattern":"try:\n    result = _local_plugin_call(profile, operation, overrides)\nexcept ValueError as e:\n    if \"require a connection_id\" in str(e):\n        cid = prompt_or_load_connection_for(profile)  # create/select a connection\n        result = _local_plugin_call(profile, operation, {**overrides, \"connection_id\": cid})\n    else:\n        raise","preventionTips":["Always pass connection_id in overrides for local-plugin profiles","Create and persist connections via ConnectionStore up front","Centralize a helper that injects the selected connection_id for local plugin calls"],"tags":["local-connector","connection","missing-argument","trading"],"backgroundTag":"missing-required-parameter","analyzedSha":"80ffdda44c5c4db0dd84d70e051cca591cea67df","analyzedAt":"2026-08-28T12:46:38.989Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}