Skip to main content
GoodFirstPicks
DashboardIssuesReposLeaderboard

GoodFirstPicks by Leaveitblank © 2026

CreatorRequest a RepoPrivacy PolicyTerms of Service
Frappe Scheduler Critical Bugs: NULL Trap + Timezone Mismatch | GoodFirstPicks

Frappe Scheduler Critical Bugs: NULL Trap + Timezone Mismatch

frappe/frappe 0 comments 1mo ago
View on GitHub
highopenScope: somewhat clearSkill match: maybeFrappe / ERPNextPython

Why this is a good first issue

Critical scheduler bugs require deep understanding of timezone handling and NULL value logic.

AI Summary

Two critical scheduler bugs cause complete failure: NULL trap prevents scheduler from starting on fresh sites, and timezone mismatches write future timestamps. Both issues require careful handling of NULL values and timezone logic in core scheduler functionality.

Issue Description

Information about bug

Summary

Two critical scheduler bugs that break ERPNext on fresh installations and deployments with timezone mismatches:

  • NULL Trap Bug: Fresh sites never start scheduler because last_execution=NULL causes silent failure
  • Timezone Bug: Mismatched timezones write future timestamps, breaking scheduler permanently

Both result in complete scheduler failure with zero error messages or warnings.

Severity: Critical - Breaks core functionality silently

Affected Versions: Frappe v15.99.0, v16.5.0 + ERPNext v15.96.1, v16.4.1 (likely all versions)

Impact: Email queue, backups, scheduled reports, all background jobs stop working


ISSUE ONE: NULL Trap on Fresh Site Creation

The Problem

Every new site created with bench new-site ends up with a broken scheduler from day one. In Scheduled Job Type, the last_execution field is either NULL or sometimes gets written as a future timestamp. Even though is_event_due() should treat NULL as due, in practice jobs are never enqueued, and last_execution stays stuck (or remains incorrectly in the future), so nothing runs automatically.

Reproduction Steps

  • Create new site
  • Start scheduler
  • Wait 10 minutes, check database

Query:

SELECT method, last_execution, stopped 
FROM `tabScheduled Job Type` 
WHERE method='frappe.email.queue.flush';

Result: last_execution remains NULL forever (see screenshot 1)

Impact

  • Email queue never processes (emails stuck in "Not Sent")
  • No scheduled tasks run (backups, reports, recurring jobs)
  • No errors logged - complete silent failure
  • bench doctor shows "Workers online: 2" (appears healthy but isn't)
  • System Health shows no issues

Root Cause

The enqueue() method in scheduled_job_type.py silently returns False for NULL values despite is_event_due() returning True. The scheduler loop calls enqueue_events() which never actually enqueues anything.

Evidence:

# Console test showing the bug
do

GitHub Labels

bug

Want to work on this?

Claim this issue to let others know you're working on it. You'll earn 30 points when you complete it!

Risk Flags

  • silent failure
  • timezone handling
  • core functionality
Loading labels...

Details

Points30 pts
Difficultyhigh
Scopesomewhat clear
Skill Matchmaybe
Test Focusedno