Skip to content

Bug?: Aws eventbridge scheduler seems to have a bug

0

In cron expression cron (30 4 31W * ? *) The next 10 trigger dates are

Wed, 31 Dec 2025 04:30:00 (UTC + 05:30)
Fri, 30 Jan 2026 04:30:00 (UTC + 05:30)
-- skips feb 2026 (which is correct, it skips all months containing 30 or 28 or 29 days)
Tue, 31 Mar 2026 04:30:00 (UTC + 05:30)
Fri, 31 Jul 2026 04:30:00 (UTC + 05:30). -- where did may go, may 31 2026 is on sun, it should give 29 may 2026
Mon, 31 Aug 2026 04:30:00 (UTC + 05:30)
Thu, 31 Dec 2026 04:30:00 (UTC + 05:30).  -- where did october go , oct 31st is on sat, it should give 30th oct2026
Fri, 29 Jan 2027 04:30:00 (UTC + 05:30)
...
....
....

In cron expression cron (30 4 15/5,22W * ? *). -- actually any number in front of W The trigger dates it gives is

Fri, 14 Nov 2025 04:30:00 (UTC + 05:30)      -- looks like trying to honor weekdays
Mon, 15 Dec 2025 04:30:00 (UTC + 05:30)
Thu, 15 Jan 2026 04:30:00 (UTC + 05:30)
Mon, 16 Feb 2026 04:30:00 (UTC + 05:30)   -- same here, trying to honor weekdays
....
....

However, In cron expression cron (30 4 15/5,22W,27 * ? *) -- this is accepted by the way by the cron expression in aws console

The next trigger dates are

Sat, 15 Nov 2025 04:30:00 (UTC +05:30)     -- why from here first of all, shouldn't it be 14th like previous one
Thu, 20 Nov 2025 04:30:00 (UTC + 05:30)
Sat, 22 Nov 2025 04:30:00 (UTC + 05:30)    -- where did this come from ?
Tue, 25 Nov 2025 04:30:00 (UTC + 05:30)
....
....
....

and in the previous one it skipped the step of 5 within the month, where has here it is observing it

Do tell, i am guessing these are bugs May be a seasoned eye can look at it and tell me what's the issue here and how should i be prepared for this seemingly erratic behaviour

asked 10 months ago237 views

2 Answers
0

The behavior you're observing with AWS EventBridge Scheduler's cron expressions isn't necessarily a bug, but rather reflects the complexity of how the W character (weekday nearest) works in combination with other cron expression elements.

For your first expression cron(30 4 31W * ? *): The W modifier means "the nearest weekday to the given day." When you specify 31W, it's looking for the nearest weekday to the 31st of each month. If a month doesn't have 31 days, it skips that month entirely rather than finding the nearest weekday to the last day of that month. For May 2026, May 31 falls on a Sunday, so the scheduler should select Friday, May 29 (the nearest weekday). Similarly, for October 2026, October 31 falls on a Saturday, so it should select Friday, October 30. The fact that these dates are missing suggests there might be an issue with how the scheduler is handling the W modifier for specific months.

For your second expression cron(30 4 15/5,22W * ? *): This is a complex expression combining multiple day-of-month selectors. The 15/5 means "starting at day 15, every 5 days" and 22W means "the weekday nearest to day 22." The scheduler appears to be correctly adjusting to weekdays when the specified date falls on a weekend.

For your third expression cron(30 4 15/5,22W,27 * ? *): Adding the 27th day to the mix changes the behavior. The scheduler now seems to be treating the 15/5 part differently, not adjusting for weekdays as it did in the second expression. The appearance of November 22 makes sense because of the 22W part, but the overall behavior does seem inconsistent with the previous expression.

These inconsistencies suggest that there might be some edge cases in how EventBridge Scheduler interprets complex cron expressions, especially when combining the W modifier with other selectors. For critical scheduling needs, I would recommend:

  1. Use simpler cron expressions when possible
  2. Always verify the next trigger dates shown in the console
  3. Consider implementing additional validation in your application logic
  4. For complex scheduling requirements, you might need to create multiple simpler schedules instead of one complex one

If these behaviors are causing issues for your application, you may want to contact AWS Support for clarification on the expected behavior.
Sources
Bug?: AWS EventBridge Rate based scheduler Ignores End Date | AWS re:Post
AWS EventBridge Scheduler Rules Fire Immediately After Terraform Deployment Outside Scheduled Window | AWS re:Post
What is Amazon EventBridge Scheduler? - EventBridge Scheduler

answered 10 months ago

EXPERT

reviewed 10 months ago

  • i hear you AI, but i think i would want a human to look at it and tell me, just saying things are inconsistent doesn't evoke confidence in using the service. So if somebody could look into it and fix some of these erratic behaviours and document them in the documentation on using cron in eventbridge scheduler. That would go a long way in building trust and confidence.

0

cron(30 4 31W * ? *) runs on the nearest weekday to 31st. Months that don't have 31st will be skipped. If your intention is to run on the last weekday of the month, change it to cron(30 4 LW * ? *).

cron(30 4 15/5,22W * ? *) means

  • Every month’s 15, 20, 25, 30 and
  • The weekday nearest to the 22nd (so if the 22nd falls on a weekend, it adjusts to Friday or Monday).

So, the key question is why the dates are different after adding 27th. You are correct that it should not change the other dates. It’s due to how AWS interprets combined day-of-month expressions, especially when mixed with “W” (weekday-nearest) and increments (like `/”). You should raise an AWS Support ticket and ask for detail explanation.

EXPERT

answered 10 months ago

  • but shouldn't the document atleast mention these caveats? See i am making a frontend where people will be able to enter the schedule they want, now if such inconsistencies are there, it would affect the credibility of my application right.

    So, what is my way forward? Either these behaviors are documented so that people who are making something on top of this can make that state not achievable , or fix these errors

    The first one where the suggestion is that use LW, but what if i wanted something run only in months with 31st days and the last weekday of the 31st month, one could go mistakenly set it 31W right, thinking it will skip, 30 or less, day months.

    So please guide me how i can get these things addressed either document such possible scenarios as invalid or something or fix these behaviours as per the expectation which the aws documents themselves claim.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.