HKUDS/Vibe-Trading · error · ValueError

alpha_id and zoo are mutually exclusive

Error message

alpha_id and zoo are mutually exclusive

What it means

_select_alpha_ids accepts either a single alpha_id or a zoo filter, never both — combining them is ambiguous about which alphas to bench and is rejected immediately.

Source

Thrown at agent/src/tools/alpha_bench_tool.py:719

    meta = alpha.meta or {}
    return {
        "id": alpha_id,
        "zoo": alpha.zoo,
        "theme": meta.get("theme", []),
        "formula_latex": meta.get("formula_latex", ""),
        "ic_mean": round(ic_mean, 6),
        "ic_std": round(ic_std, 6),
        "ir": round(ir, 4),
        "ic_positive_ratio": round(ic_pos, 4),
        "ic_count": int(len(ic_series)),
    }


def _select_alpha_ids(
    registry: Any, *, alpha_id: str | None, zoo: str | None
) -> list[str]:
    if alpha_id and zoo:
        raise ValueError("alpha_id and zoo are mutually exclusive")
    if alpha_id:
        registry.get(alpha_id)  # raises KeyError if unknown
        return [alpha_id]
    if zoo:
        return registry.list(zoo=zoo)
    return registry.list()


# ---------------------------------------------------------------------------
# HTML rendering
# ---------------------------------------------------------------------------

_CSP = (
    "<meta http-equiv=\"Content-Security-Policy\" "
    "content=\"default-src 'none'; style-src 'unsafe-inline'; script-src 'none'\">"
)

_REPORT_CSS = """

View on GitHub (pinned to 80ffdda44c)

Solutions

  1. Pass only one: alpha_id for a single alpha, zoo for a filtered set
  2. Omit the unused parameter entirely (None) rather than empty string
  3. In wrappers, drop empty-string values to None before forwarding

Example fix

// before
run_alpha_bench(universe='csi300', period='2023', alpha_id='mom', zoo='technical')
// after
run_alpha_bench(universe='csi300', period='2023', alpha_id='mom')
Defensive patterns

Strategy: validation

Validate before calling

alpha_id = alpha_id or None; zoo = zoo or None
assert not (alpha_id and zoo)

Prevention

When it happens

Trigger: Calling run_alpha_bench with both alpha_id='momentum' and zoo='technical' set to non-empty values.

Common situations: Wrapper code that forwards optional kwargs verbatim; LLM tool calls filling every field; defaults changed so both become populated.

Related errors


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