{"record":{"id":"0a1033a7717a678e","repo":"HKUDS/Vibe-Trading","slug":"live-trading-or-execution-goals-are-not-supported","errorCode":null,"errorMessage":"live trading or execution goals are not supported","messagePattern":"live trading or execution goals are not supported","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"agent/src/api/sessions_routes.py","lineNumber":457,"sourceCode":"        status_code=status.HTTP_201_CREATED,\n        dependencies=[Depends(require_auth)],\n    )\n    async def create_session_goal(session_id: str, req: CreateGoalRequest):\n        \"\"\"Create or replace the current finance research goal for a session.\"\"\"\n        _host_validate_path_param(session_id, \"session_id\")\n        svc, _session = _get_existing_session_or_404(session_id)\n        from src.goal import RiskTier\n        from src.goal.context import default_goal_criteria\n\n        criteria = [item.strip() for item in req.criteria if item.strip()]\n        if not criteria:\n            criteria = default_goal_criteria()\n        try:\n            risk_tier = RiskTier(req.risk_tier)\n        except ValueError as exc:\n            raise HTTPException(status_code=400, detail=f\"invalid risk_tier: {req.risk_tier}\") from exc\n        if risk_tier is RiskTier.LIVE_TRADING_OR_EXECUTION:\n            raise HTTPException(status_code=400, detail=\"live trading or execution goals are not supported\")\n\n        goal_store = _get_goal_store()\n        try:\n            goal = goal_store.replace_goal(\n                session_id=session_id,\n                objective=req.objective,\n                criteria=criteria,\n                ui_summary=req.ui_summary,\n                source=\"api\",\n                protocol=req.protocol,\n                risk_tier=risk_tier,\n                token_budget=req.token_budget,\n                turn_budget=req.turn_budget,\n                time_budget_seconds=req.time_budget_seconds,\n            )\n        except ValueError as exc:\n            raise HTTPException(status_code=400, detail=str(exc)) from exc\n        snapshot = goal_store.get_goal_snapshot(goal.goal_id)","sourceCodeStart":439,"sourceCodeEnd":475,"githubUrl":"https://github.com/HKUDS/Vibe-Trading/blob/80ffdda44c5c4db0dd84d70e051cca591cea67df/agent/src/api/sessions_routes.py#L439-L475","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Choose a non-execution risk tier (e.g. the research/advisory tiers the enum provides)","Keep live execution out of the goal API by design — implement execution in a dedicated, separately-authorized system","If you believe execution should be supported, check with the project maintainers; it is deliberately blocked","Audit automated pipelines so they never forward user-supplied tiers unchecked"],"exampleFix":"# before\napi.create_session_goal(sid, objective=\"trade my account\", risk_tier=\"LIVE_TRADING_OR_EXECUTION\")  # 400\n\n# after\napi.create_session_goal(sid, objective=\"research trade setups\", risk_tier=\"MEDIUM_RISK\")  # research-only tier","handlingStrategy":"validation","validationCode":"LIVE_TIERS = {\"LIVE_TRADING_OR_EXECUTION\"}  # values the API refuses\nif payload[\"risk_tier\"] in LIVE_TIERS:\n    raise ValueError(\"Live trading/execution goals are rejected by policy; use a research tier\")","typeGuard":"def is_rejected_tier(v: str) -> bool:\n    \"\"\"True when the goal API will refuse this tier outright.\"\"\"\n    return v == \"LIVE_TRADING_OR_EXECUTION\"","tryCatchPattern":"try:\n    goal = api.create_session_goal(sid, payload)\nexcept HTTPError as e:\n    if e.response.status_code == 400 and \"not supported\" in e.response.text:\n        raise PermissionError(\"Execution-tier goals are blocked; choose a research tier\") from e\n    raise","preventionTips":["Never pass user input as risk_tier unvalidated","Keep execution logic in dedicated, separately-authorized systems","Document the research-only scope wherever goals are configured"],"tags":["validation","http-400","goals","risk-tier","policy"],"backgroundTag":"disallowed-operation-policy","analyzedSha":"80ffdda44c5c4db0dd84d70e051cca591cea67df","analyzedAt":"2026-08-28T12:46:38.989Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}