{"record":{"id":"3d08fd09ca8adea8","repo":"harry0703/MoneyPrinterTurbo","slug":"request-id-str-e","errorCode":null,"errorMessage":"{request_id}: {str(e)}","messagePattern":"\\{request_id\\}: \\{str\\(e\\)\\}","errorType":"http","errorClass":"HttpException","httpStatus":429,"severity":"warning","filePath":"app/controllers/v1/video.py","lineNumber":217,"sourceCode":"):\n    task_id = utils.get_uuid()\n    request_id = base.get_task_id(request)\n    try:\n        task = {\n            \"task_id\": task_id,\n            \"request_id\": request_id,\n            \"params\": body.model_dump(),\n        }\n        sm.state.update_task(task_id)\n        task_manager.add_task(tm.start, task_id=task_id, params=body, stop_at=stop_at)\n        logger.success(f\"Task created: {utils.to_json(task)}\")\n        return utils.get_response(200, task)\n    except TaskQueueFullError as e:\n        sm.state.delete_task(task_id)\n        logger.warning(\n            f\"reject task because queue is full, request_id: {request_id}, task_id: {task_id}\"\n        )\n        raise HttpException(\n            task_id=task_id, status_code=429, message=f\"{request_id}: {str(e)}\"\n        )\n    except ValueError as e:\n        raise HttpException(\n            task_id=task_id, status_code=400, message=f\"{request_id}: {str(e)}\"\n        )\n\n@router.get(\"/tasks\", response_model=TaskListResponse, summary=\"Get all tasks\")\ndef get_all_tasks(\n    request: Request,\n    page: int = Query(1, ge=1),\n    page_size: int = Query(10, ge=1),\n):\n    tasks, total = sm.state.get_all_tasks(page, page_size)\n\n    response = {\n        \"tasks\": [_public_task_data(task) for task in tasks],\n        \"total\": total,","sourceCodeStart":199,"sourceCodeEnd":235,"githubUrl":"https://github.com/harry0703/MoneyPrinterTurbo/blob/1f9f19c2021a68d04df228f33e9099a0c947f6f8/app/controllers/v1/video.py#L199-L235","documentation":"Raised in create_video (app/controllers/v1/video.py) when task_manager.add_task raises TaskQueueFullError. The handler is cleanup-aware: it deletes the just-created task record from state (so the rejected task does not linger) before returning 429 with the queue-full message. This is the HTTP-visible form of the manager's bounded-queue backpressure described in error 1.","triggerScenarios":"POST /api/v1/videos while all workers are busy and the queue is at max_queued_tasks; burst creation of video tasks from a script; upstream generation API slowness causing queue saturation.","commonSituations":"Batch generation scripts without retry/backoff; concurrency budget sized below real traffic; stuck tasks pinning workers so the queue never drains.","solutions":["Retry the POST with exponential backoff + jitter; the task was not created, so a plain resubmission is safe (no duplicate-task cleanup needed).","Check GET /api/v1/tasks for stuck running tasks and delete them to free capacity.","Raise max_concurrent_tasks / max_queued_tasks in the video controller's InMemoryTaskManager settings if the load is legitimate.","Throttle submitters client-side to smooth bursts."],"exampleFix":"# before\nresp = requests.post(f\"{base}/api/v1/videos\", json=body, headers=h)\nresp.raise_for_status()\n\n# after\nimport time, random\nfor attempt in range(6):\n    resp = requests.post(f\"{base}/api/v1/videos\", json=body, headers=h)\n    if resp.status_code != 429:\n        break\n    time.sleep(min(60, (2 ** attempt) + random.random()))\nresp.raise_for_status()","handlingStrategy":"retry","validationCode":"# probe queue pressure before a burst\nresp = requests.get(f\"{base}/api/v1/tasks?page=1&page_size=1\", headers=h)\n# if your deployment reports many active tasks, delay the burst","typeGuard":"def is_retryable_queue_reject(resp) -> bool:\n    return resp.status_code == 429 and \"queue is full\" in resp.text","tryCatchPattern":"for attempt in range(6):\n    try:\n        resp = post_video_task(body)\n        break\n    except TaskQueueRejected:  # 429 mapped in your client SDK\n        time.sleep(min(60, 2 ** attempt + random.random()))\nelse:\n    raise RuntimeError(\"video queue saturated; try later\")","preventionTips":["Wrap every create-task call in bounded exponential backoff.","The 429 handler deleted the task server-side, so a plain resubmit never duplicates work.","Cap client-side concurrency to the server's advertised max_concurrent_tasks."],"tags":["backpressure","video-generation","http-429","retry"],"backgroundTag":null,"analyzedSha":"1f9f19c2021a68d04df228f33e9099a0c947f6f8","analyzedAt":"2026-08-14T19:41:05.568Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}