{"record":{"id":"a570611198e874bc","repo":"unclecode/crawl4ai","slug":"invalid-status-status-must-be-one-of-all-act","errorCode":null,"errorMessage":"Invalid status: {status}. Must be one of: all, active, completed, success, error","messagePattern":"Invalid status: (.+?)\\. Must be one of: all, active, completed, success, error","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"deploy/docker/monitor_routes.py","lineNumber":36,"sourceCode":"    try:\n        monitor = get_monitor()\n        return await monitor.get_health_summary()\n    except Exception as e:\n        logger.error(f\"Error getting health: {e}\")\n        raise HTTPException(500, str(e))\n\n\n@router.get(\"/requests\")\nasync def get_requests(status: str = \"all\", limit: int = 50):\n    \"\"\"Get active and completed requests.\n\n    Args:\n        status: Filter by 'active', 'completed', 'success', 'error', or 'all'\n        limit: Max number of completed requests to return (default 50)\n    \"\"\"\n    # Input validation\n    if status not in [\"all\", \"active\", \"completed\", \"success\", \"error\"]:\n        raise HTTPException(400, f\"Invalid status: {status}. Must be one of: all, active, completed, success, error\")\n    if limit < 1 or limit > 1000:\n        raise HTTPException(400, f\"Invalid limit: {limit}. Must be between 1 and 1000\")\n\n    try:\n        monitor = get_monitor()\n\n        if status == \"active\":\n            return {\"active\": monitor.get_active_requests(), \"completed\": []}\n        elif status == \"completed\":\n            return {\"active\": [], \"completed\": monitor.get_completed_requests(limit)}\n        elif status in [\"success\", \"error\"]:\n            return {\"active\": [], \"completed\": monitor.get_completed_requests(limit, status)}\n        else:  # \"all\"\n            return {\n                \"active\": monitor.get_active_requests(),\n                \"completed\": monitor.get_completed_requests(limit)\n            }\n    except Exception as e:","sourceCodeStart":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/unclecode/crawl4ai/blob/7e801521428ee12509994d39151006f64055ebe3/deploy/docker/monitor_routes.py#L18-L54","documentation":"GET /monitor/requests validates its status query parameter against the fixed set {all, active, completed, success, error} before touching the monitor; anything else raises HTTPException(400) listing the valid values. This is an input-validation guard at the API boundary, not an internal failure.","triggerScenarios":"GET /monitor/requests?status=running, ?status=FAILED (wrong case), ?status=error%20 (whitespace), or any other unlisted string.","commonSituations":"Clients assuming dashboard vocabulary ('running', 'pending') matches the API's; case-sensitive queries; URL-encoding mistakes adding whitespace.","solutions":["Use one of: all, active, completed, success, error — exact lowercase match.","Lowercase and trim the filter client-side before sending.","Treat the 400 body as authoritative; it enumerates the allowed set."],"exampleFix":"# before\nGET /monitor/requests?status=Running\n\n# after\nGET /monitor/requests?status=active","handlingStrategy":"validation","validationCode":"VALID_STATUSES = {\"all\", \"active\", \"completed\", \"success\", \"error\"}\n\ndef safe_status(s: str) -> str:\n    s = (s or \"all\").strip().lower()\n    return s if s in VALID_STATUSES else \"all\"","typeGuard":"def is_valid_monitor_status(s) -> bool:\n    return isinstance(s, str) and s in {\"all\", \"active\", \"completed\", \"success\", \"error\"}","tryCatchPattern":null,"preventionTips":["Normalize status filters to lowercase and trim whitespace before sending.","Drive UI dropdowns from the documented five-value set.","Treat any 400 from this route as a client bug — fix the caller, don't retry."],"tags":["http-400","validation","monitoring","api"],"backgroundTag":null,"analyzedSha":"7e801521428ee12509994d39151006f64055ebe3","analyzedAt":"2026-08-14T20:46:20.673Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}