OpenBMB/ChatDev · error · HTTPException

max_parallel must be >= 1

Error message

max_parallel must be >= 1

What it means

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.

Source

Thrown at server/routes/batch.py:28

router = APIRouter()


@router.post("/api/workflows/batch")
async def execute_batch(
    file: UploadFile = File(...),
    session_id: str = Form(...),
    yaml_file: str = Form(...),
    max_parallel: int = Form(5),
    log_level: str | None = Form(None),
):
    try:
        manager = ensure_known_session(session_id, require_connection=True)
    except ValidationError as exc:
        raise HTTPException(status_code=400, detail=str(exc))

    if max_parallel < 1:
        raise HTTPException(status_code=400, detail="max_parallel must be >= 1")

    try:
        content = await file.read()
        tasks, file_base = parse_batch_file(content, file.filename or "batch.csv")
    except ValidationError as exc:
        raise HTTPException(status_code=400, detail=str(exc))

    resolved_level = None
    if log_level:
        try:
            resolved_level = LogLevel(log_level)
        except ValueError:
            raise HTTPException(status_code=400, detail="log_level must be either DEBUG or INFO")

    service = BatchRunService()
    asyncio.create_task(
        service.run_batch(
            session_id,

View on GitHub (pinned to 4fb2db0ea9)

Solutions

  1. Set max_parallel to 1 or higher
  2. Treat 0/'auto' client-side by substituting a sensible default like 4 before sending
  3. Validate the value in your client form before submission

Example fix

# before
max_parallel: 0
# after
max_parallel: 4
Defensive patterns

Strategy: validation

Validate before calling

max_parallel = max(int(max_parallel or 0), 1)  # clamp before sending
assert max_parallel >= 1

Type guard

def is_valid_parallel(v) -> bool:
    return isinstance(v, int) and v >= 1

Try / catch

if resp.status_code == 400 and 'max_parallel' in resp.text:
    max_parallel = 4
    resp = client.execute_batch(..., max_parallel=max_parallel)

Prevention

When it happens

Trigger: POST to the batch execution endpoint with max_parallel=0 or a negative number, or a client defaulting an unset integer to 0.

Common situations: UI spinners that send 0 meaning 'auto'; miscomputed concurrency from len(tasks)-style arithmetic; config files with parallelism: 0.

Related errors


AI-assisted analysis of OpenBMB/ChatDev@4fb2db0ea9 (2026-08-27). Data as JSON: /api/errors/14c328862461bf44. Report an issue: GitHub.