{"record":{"id":"9765055f8bbbe343","repo":"Significant-Gravitas/AutoGPT","slug":"expert-name-is-archived-her-schedules-do-not-ru","errorCode":null,"errorMessage":"{expert.name} is archived; her schedules do not run.","messagePattern":"(.+?) is archived; her schedules do not run\\.","errorType":"exception","errorClass":"ExpertRunPausedError","httpStatus":409,"severity":"warning","filePath":"autogpt_platform/backend/backend/api/features/experts/scheduling.py","lineNumber":299,"sourceCode":"\n    Raises ExpertRunPausedError when the expert is archived, paused, or has\n    hit her weekly credit budget — breaching pauses her and posts an\n    in-thread message. Approaching the budget posts a once-per-week warning.\n\n    The spend read is a snapshot, not an atomic reservation: N runs firing\n    in the same instant can each pass the check before any of them meters\n    cost. That overshoot is bounded by per-run cost × concurrent firings,\n    the next gate check pauses her, and the durable wallet (credit system)\n    is charged correctly regardless — this gate is a churn guardrail, not\n    the billing ledger, so the simpler check is the deliberate trade-off.\n    \"\"\"\n    expert = await prisma.models.Expert.prisma().find_first(\n        where={\"id\": expert_id, \"ownerUserId\": user_id, \"isTemplate\": False}\n    )\n    if expert is None:\n        return\n    if expert.isArchived:\n        raise ExpertRunPausedError(\n            f\"{expert.name} is archived; her schedules do not run.\", expert_id\n        )\n    if expert.schedulesPausedAt is not None:\n        raise ExpertRunPausedError(f\"{expert.name}'s schedules are paused.\", expert_id)\n    budget = effective_weekly_budget(expert)\n    if budget is None:\n        return\n    spent = await get_weekly_spend(expert_id)\n    if spent >= budget:\n        await pause_expert_schedules(\n            user_id,\n            expert_id,\n            reason=f\"Weekly credit budget reached ({spent}/{budget})\",\n        )\n        await _post_budget_message(user_id, expert, spent, budget, breached=True)\n        raise ExpertRunPausedError(\n            f\"{expert.name} hit her weekly credit budget ({spent}/{budget}); \"\n            \"schedules are paused until you resume them.\",","sourceCodeStart":281,"sourceCodeEnd":317,"githubUrl":"https://github.com/Significant-Gravitas/AutoGPT/blob/9c8bb5550f446ba5d3046b78896578742495b3cf/autogpt_platform/backend/backend/api/features/experts/scheduling.py#L281-L317","documentation":"ExpertRunPausedError (a ValueError subclass, backend/util/exceptions.py:185) raised by the schedule run-time gate in scheduling.py:299: the expert exists but isArchived is True, so her schedules refuse to run. This is a deliberate backstop — archived experts keep their schedule rows, but execution is blocked even if trigger detachment failed during archive.","triggerScenarios":"A scheduled trigger fires for an expert after archive_expert ran — e.g. the detach_expert_triggers call inside archive failed (it is swallowed with a logged exception), leaving a live trigger, and the scheduler then invokes the gate.","commonSituations":"Scheduler hiccups during archive; triggers recreated manually after archiving; delayed/queued trigger deliveries arriving after the user archived the expert.","solutions":["Expected behavior: unarchive (re-hire the template revives the row) if you want schedules to run again.","If triggers keep firing for archived experts, call the detach/cleanup path again or inspect scheduler state — the gate already prevented the run.","Handle the error non-fatally in the execution path; it is a guardrail, not a bug."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"expert = await get_expert(user_id, expert_id)\nif expert is not None and expert.is_archived:\n    skip_schedule_run()  # don't even attempt the run","typeGuard":"def blocks_runs(e: Expert) -> bool:\n    return e.is_archived or e.schedules_paused_at is not None","tryCatchPattern":"try:\n    await gate_and_run(...)\nexcept ExpertRunPausedError as e:\n    logger.info(f'schedule refused: {e}')  # expected backstop; do not alert","preventionTips":["Detach triggers when archiving and verify detachment succeeded (don't rely solely on this gate).","Treat ExpertRunPausedError as expected control flow, not an incident.","To resume runs, re-hire the template to revive the expert."],"tags":["experts","scheduling","archive","guardrail","backend"],"backgroundTag":null,"analyzedSha":"9c8bb5550f446ba5d3046b78896578742495b3cf","analyzedAt":"2026-08-14T17:17:21.957Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}