{"record":{"id":"280ac6dd6aa02e29","repo":"HKUDS/Vibe-Trading","slug":"job-job-id-not-found","errorCode":null,"errorMessage":"job {job_id} not found","messagePattern":"job (.+?) not found","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"error","filePath":"agent/src/api/alpha_routes.py","lineNumber":578,"sourceCode":"        _RUNNING_TASKS.add(task)\n        task.add_done_callback(_RUNNING_TASKS.discard)\n        return {\"status\": \"ok\", \"job_id\": job_id}\n\n    # -----------------------------------------------------------------------\n    # GET /alpha/bench/{job_id}/stream\n    # -----------------------------------------------------------------------\n\n    @app.get(\n        \"/alpha/bench/{job_id}/stream\",\n        dependencies=[Depends(require_event_stream_auth)],\n    )\n    async def stream_bench(job_id: str, request: Request) -> StreamingResponse:\n        \"\"\"SSE: progress / result / done / error until the job terminates.\"\"\"\n        if not _JOB_ID_RE.fullmatch(job_id or \"\"):\n            raise HTTPException(status_code=400, detail=\"invalid job_id\")\n        with _JOBS_LOCK:\n            if job_id not in ALPHA_BENCH_JOBS:\n                raise HTTPException(status_code=404, detail=f\"job {job_id} not found\")\n        return _job_event_stream(ALPHA_BENCH_JOBS, job_id, request, _result_for_wire)\n\n    # -----------------------------------------------------------------------\n    # POST /alpha/compare\n    # -----------------------------------------------------------------------\n\n    @app.post(\n        \"/alpha/compare\",\n        status_code=202,\n        dependencies=[Depends(require_auth)],\n    )\n    async def kick_off_compare(payload: CompareRequest) -> dict[str, Any]:\n        \"\"\"Queue a background head-to-head comparison and return a job_id.\"\"\"\n        from src.tools.alpha_bench_tool import _parse_period\n\n        try:\n            _parse_period(payload.period)\n        except ValueError as exc:","sourceCodeStart":560,"sourceCodeEnd":596,"githubUrl":"https://github.com/HKUDS/Vibe-Trading/blob/80ffdda44c5c4db0dd84d70e051cca591cea67df/agent/src/api/alpha_routes.py#L560-L596","documentation":"The tool's execute() only accepts five actions: status, lookup, latest, history, universe. Any other action string raises this ValueError immediately. The action also drives whether stock_ids is required (lookup/latest/history) and which handler runs.","triggerScenarios":"Calling execute(action='quote'), action='search', action='STATUS' (case-sensitive match against the literal set), or a typo like 'histroy'. The membership test is exact-string against the allowed set.","commonSituations":"LLM tool callers inventing action names not in the tool schema; refactoring that renamed an action without updating callers; case mismatch from uppercase enums; frontend dropdown values drifting from the backend set.","solutions":["Use one of: status, lookup, latest, history, universe exactly (lowercase)","Lowercase and validate before calling: action=raw.strip().lower(); assert action in ALLOWED","If you need a missing capability, extend the tool's action set and schema rather than passing new names"],"exampleFix":"# before\nexecute(action='SEARCH', stock_ids=['2330'])\n# after\nexecute(action='lookup', stock_ids=['2330'])","handlingStrategy":"validation","validationCode":"ALLOWED_ACTIONS = {'status','lookup','latest','history','universe'}\naction = str(raw_action).strip().lower()\nif action not in ALLOWED_ACTIONS:\n    raise ValueError(f'unknown action {action!r}; allowed: {sorted(ALLOWED_ACTIONS)}')","typeGuard":"from typing import Literal\nAction = Literal['status','lookup','latest','history','universe']\ndef is_action(v) -> bool:\n    return v in {'status','lookup','latest','history','universe'}","tryCatchPattern":"try:\n    tool.execute(action=action, **kwargs)\nexcept ValueError as e:\n    if 'action must be' in str(e):\n        action = 'status'  # safe fallback\n        result = tool.execute(action='status')\n    else:\n        raise","preventionTips":["Use an enum/Literal and lowercase normalization for action strings","Keep the tool schema's enum list in sync with the handler set"],"tags":["python","validation","enum-value","dispatcher"],"backgroundTag":"invalid-enum-value","analyzedSha":"80ffdda44c5c4db0dd84d70e051cca591cea67df","analyzedAt":"2026-08-28T12:46:38.989Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}