Significant-Gravitas/AutoGPT · error · HTTPException
Nightly batch scheduling failed: {type(exc).__name__}: {exc}
Error message
Nightly batch scheduling failed: {type(exc).__name__}: {exc} What it means
HTTP 500 raised when the nightly batch trigger is accepted (202 flow started, initial status written) but get_scheduler_client().schedule_immediate_nightly_batch raises. The job row is marked failed via _mark_schedule_failed and the exception type and message are included in the response detail.
Source
Thrown at autogpt_platform/backend/backend/api/features/admin/memory_admin_routes.py:897
except ValueError as exc:
raise HTTPException(status_code=400, detail=str(exc))
job_id = str(_uuid.uuid4())
status = await write_initial_status(kind="nightly", job_id=job_id, user_id=target)
try:
await get_scheduler_client().schedule_immediate_nightly_batch(
user_id=target, job_id=job_id
)
except Exception as exc:
logger.warning(
"Failed to schedule nightly batch %s for user %s: %s",
job_id[:12],
target[:12],
exc,
)
await _mark_schedule_failed("nightly", job_id, exc)
raise HTTPException(
status_code=500,
detail=f"Nightly batch scheduling failed: {type(exc).__name__}: {exc}",
)
payload = JobTriggerResponse(
job_id=status.job_id,
user_id=status.user_id,
kind=status.kind,
state=status.state,
started_at=status.started_at,
)
return JSONResponse(status_code=202, content=payload.model_dump(mode="json"))
@router.get(
"/{user_id}/nightly/{job_id}",
response_model=NightlyJobStatus,
)View on GitHub (pinned to 9c8bb5550f)
Solutions
- Check the 'Failed to schedule nightly batch' warning in API logs for the underlying exception
- Ensure scheduler and broker services are healthy and the API can connect (docker compose ps, network settings)
- Poll GET /{user_id}/nightly/{job_id}/status to confirm the failed state, then re-trigger to get a fresh job
- Align API and scheduler versions/config if a deploy left them inconsistent
Defensive patterns
Strategy: retry
Validate before calling
# Before triggering, confirm broker/scheduler reachable from ops dashboard or healthcheck
Try / catch
except httpx.HTTPStatusError as e:
if e.response.status_code == 500 and "Nightly batch scheduling failed" in e.response.json()["detail"]:
await backoff_and_retry_once() # job row already marked failed; new POST issues new job_id
raise Prevention
- Run scheduler/broker as supervised services with restart policies
- On 500, always fetch the failed job status before retrying to confirm cause
- Don't reuse the job_id from a failed trigger
When it happens
Trigger: POST /{user_id}/nightly where scheduling enqueue fails: scheduler/broker down, credential or network mismatch between API and scheduler, or an exception inside the scheduler client. The response is 500 and the stored job state transitions to failed.
Common situations: Scheduler process not started in dev; RabbitMQ/Redis container stopped or restarting at the moment of the call; env var drift after config changes; scheduler overloaded rejecting connections.
Related errors
- Dream pass scheduling failed: {type(exc).__name__}: {exc}
- Community rebuild scheduling failed: {type(exc).__name__}: {
- Ratification pass failed: {type(exc).__name__}: {exc}
- str(e)
- OpenAI API key not configured
AI-assisted analysis of Significant-Gravitas/AutoGPT@9c8bb5550f (2026-08-14).
Data as JSON: /api/errors/a5ffba3b722db16c.
Report an issue: GitHub.