HKUDS/Vibe-Trading · error · HTTPException

live trading or execution goals are not supported

Error message

live trading or execution goals are not supported

What it means

Even a structurally valid risk_tier is rejected with 400 if it equals RiskTier.LIVE_TRADING_OR_EXECUTION: the goal system intentionally refuses to create goals that would direct live trading or execution, a hard product/safety boundary rather than a parse error.

Source

Thrown at agent/src/api/sessions_routes.py:457

        status_code=status.HTTP_201_CREATED,
        dependencies=[Depends(require_auth)],
    )
    async def create_session_goal(session_id: str, req: CreateGoalRequest):
        """Create or replace the current finance research goal for a session."""
        _host_validate_path_param(session_id, "session_id")
        svc, _session = _get_existing_session_or_404(session_id)
        from src.goal import RiskTier
        from src.goal.context import default_goal_criteria

        criteria = [item.strip() for item in req.criteria if item.strip()]
        if not criteria:
            criteria = default_goal_criteria()
        try:
            risk_tier = RiskTier(req.risk_tier)
        except ValueError as exc:
            raise HTTPException(status_code=400, detail=f"invalid risk_tier: {req.risk_tier}") from exc
        if risk_tier is RiskTier.LIVE_TRADING_OR_EXECUTION:
            raise HTTPException(status_code=400, detail="live trading or execution goals are not supported")

        goal_store = _get_goal_store()
        try:
            goal = goal_store.replace_goal(
                session_id=session_id,
                objective=req.objective,
                criteria=criteria,
                ui_summary=req.ui_summary,
                source="api",
                protocol=req.protocol,
                risk_tier=risk_tier,
                token_budget=req.token_budget,
                turn_budget=req.turn_budget,
                time_budget_seconds=req.time_budget_seconds,
            )
        except ValueError as exc:
            raise HTTPException(status_code=400, detail=str(exc)) from exc
        snapshot = goal_store.get_goal_snapshot(goal.goal_id)

View on GitHub (pinned to 80ffdda44c)

Solutions

  1. Choose a non-execution risk tier (e.g. the research/advisory tiers the enum provides)
  2. Keep live execution out of the goal API by design — implement execution in a dedicated, separately-authorized system
  3. If you believe execution should be supported, check with the project maintainers; it is deliberately blocked
  4. Audit automated pipelines so they never forward user-supplied tiers unchecked

Example fix

# before
api.create_session_goal(sid, objective="trade my account", risk_tier="LIVE_TRADING_OR_EXECUTION")  # 400

# after
api.create_session_goal(sid, objective="research trade setups", risk_tier="MEDIUM_RISK")  # research-only tier
Defensive patterns

Strategy: validation

Validate before calling

LIVE_TIERS = {"LIVE_TRADING_OR_EXECUTION"}  # values the API refuses
if payload["risk_tier"] in LIVE_TIERS:
    raise ValueError("Live trading/execution goals are rejected by policy; use a research tier")

Type guard

def is_rejected_tier(v: str) -> bool:
    """True when the goal API will refuse this tier outright."""
    return v == "LIVE_TRADING_OR_EXECUTION"

Try / catch

try:
    goal = api.create_session_goal(sid, payload)
except HTTPError as e:
    if e.response.status_code == 400 and "not supported" in e.response.text:
        raise PermissionError("Execution-tier goals are blocked; choose a research tier") from e
    raise

Prevention

When it happens

Trigger: POST /sessions/{id}/goal with risk_tier set to the live-trading/execution tier (exact enum member), which the route checks immediately after successful RiskTier() conversion.

Common situations: Users trying to drive real trading through the research-goal API; porting a workflow from a system that allowed execution tiers; enum auto-complete selecting the most permissive-looking value; misunderstanding that the agent is research-only.

Related errors


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