🐛 Bug Report: Double-clicking "Run now" on a schedule crashes the Schedules page
📜 Description
Clicking "Run now" on a schedule again while its first run is still going (a double-click is enough) replaces the Schedules page with "Something went wrong displaying this content".
The second POST /api/schedules/<id>/run gets a 409 ("a run is already in flight"). schedulesService.runNow returns that error body as if it were the run, so undefined ends up in the run log and RunLog throws on run.scheduled_for. "Try again" brings the page back, but opening the run log crashes it again until a full reload. setPaused does the same on a 409.
👟 Reproduction steps
- Open an agent's Schedules page and expand a schedule's run log.
- Double-click "Run now", or click it again before the first run finishes.
- The page is replaced by "Something went wrong displaying this content".
👍 Expected behavior
The second click is refused and the page keeps showing the run log with the run that's already going.
👎 Actual Behavior with Screenshots
The page content is replaced by the error screen. Console:
TypeError: Cannot read properties of undefined (reading 'scheduled_for')
at RunLog.tsx:144
💻 Operating system
MacOS
What browsers are you seeing the problem on?
Chrome
🤖 What development environment are you experiencing this bug on?
Local dev server
🔒 Did you set the correct environment variables in the right path? List the environment variable names (not values please!)
LLM_NAME, INTERNAL_KEY, POSTGRES_URI, CELERY_BROKER_URL, CELERY_RESULT_BACKEND, CACHE_REDIS_URL, started with docsgpt dev --ui --mock-llm.
📃 Provide any additional context for the Bug.
Seen on main at 983e99a3. create and update in the same service already go through savedOrThrow; runNow and setPaused still use plain json().
📖 Relevant log output
"POST /api/schedules/2d92aa4b-cbca-4d62-8e21-7aa048d694f1/run HTTP/1.1" 202 Accepted
"POST /api/schedules/2d92aa4b-cbca-4d62-8e21-7aa048d694f1/run HTTP/1.1" 409 Conflict
👀 Have you spent some time to check if this bug has been raised before?
- [x] I checked and didn't find similar issue
🔗 Are you willing to submit PR?
Yes, I am willing to submit a PR!
I'd like to work on this: runNow and setPaused should go through savedOrThrow like create and update, so a 409 rejects instead of landing in the run log. I'll add tests to schedulesService.test.ts.
@prakashNalla, you're assigned.
- Open a PR or post progress here within 14 days; otherwise the issue will be available to others again.
- Read
CONTRIBUTING.mdandfrontend/DESIGN.mdfor this frontend work. - Include tests for the 409 responses from both
runNowandsetPaused, plus a screenshot or short recording showing the page stays usable after a repeated "Run now" click.
Automated triage. A maintainer will follow up.