{"record":{"id":"14c328862461bf44","repo":"OpenBMB/ChatDev","slug":"max-parallel-must-be-1","errorCode":null,"errorMessage":"max_parallel must be >= 1","messagePattern":"max_parallel must be >= 1","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"server/routes/batch.py","lineNumber":28,"sourceCode":"\nrouter = APIRouter()\n\n\n@router.post(\"/api/workflows/batch\")\nasync def execute_batch(\n    file: UploadFile = File(...),\n    session_id: str = Form(...),\n    yaml_file: str = Form(...),\n    max_parallel: int = Form(5),\n    log_level: str | None = Form(None),\n):\n    try:\n        manager = ensure_known_session(session_id, require_connection=True)\n    except ValidationError as exc:\n        raise HTTPException(status_code=400, detail=str(exc))\n\n    if max_parallel < 1:\n        raise HTTPException(status_code=400, detail=\"max_parallel must be >= 1\")\n\n    try:\n        content = await file.read()\n        tasks, file_base = parse_batch_file(content, file.filename or \"batch.csv\")\n    except ValidationError as exc:\n        raise HTTPException(status_code=400, detail=str(exc))\n\n    resolved_level = None\n    if log_level:\n        try:\n            resolved_level = LogLevel(log_level)\n        except ValueError:\n            raise HTTPException(status_code=400, detail=\"log_level must be either DEBUG or INFO\")\n\n    service = BatchRunService()\n    asyncio.create_task(\n        service.run_batch(\n            session_id,","sourceCodeStart":10,"sourceCodeEnd":46,"githubUrl":"https://github.com/OpenBMB/ChatDev/blob/4fb2db0ea90375ce1059f44fe03ffbd191a7a169/server/routes/batch.py#L10-L46","documentation":"execute_batch validates the max_parallel query/body parameter and rejects values below 1 with HTTP 400. The server will not run a batch with zero or negative concurrency.","triggerScenarios":"POST to the batch execution endpoint with max_parallel=0 or a negative number, or a client defaulting an unset integer to 0.","commonSituations":"UI spinners that send 0 meaning 'auto'; miscomputed concurrency from len(tasks)-style arithmetic; config files with parallelism: 0.","solutions":["Set max_parallel to 1 or higher","Treat 0/'auto' client-side by substituting a sensible default like 4 before sending","Validate the value in your client form before submission"],"exampleFix":"# before\nmax_parallel: 0\n# after\nmax_parallel: 4","handlingStrategy":"validation","validationCode":"max_parallel = max(int(max_parallel or 0), 1)  # clamp before sending\nassert max_parallel >= 1","typeGuard":"def is_valid_parallel(v) -> bool:\n    return isinstance(v, int) and v >= 1","tryCatchPattern":"if resp.status_code == 400 and 'max_parallel' in resp.text:\n    max_parallel = 4\n    resp = client.execute_batch(..., max_parallel=max_parallel)","preventionTips":["Map UI 'auto' concurrency to a concrete default client-side","Clamp concurrency inputs before API calls"],"tags":["http-400","batch","validation"],"backgroundTag":"invalid-parameter","analyzedSha":"4fb2db0ea90375ce1059f44fe03ffbd191a7a169","analyzedAt":"2026-08-27T14:35:29.622Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}