phacility/phabricator · error · Exception
RRULE specifies BYYEARDAY with FREQ of DAILY, WEEKLY or MONT
Error message
RRULE specifies BYYEARDAY with FREQ of DAILY, WEEKLY or MONTHLY, which violates RFC5545.
What it means
RFC5545 forbids BYYEARDAY when FREQ is DAILY, WEEKLY, or MONTHLY, since a year-day index cannot be applied on those cycles. PhutilCalendarRecurrenceRule::resetSource() throws during rule initialization whenever both a BYYEARDAY list and one of those frequencies are present.
Source
Thrown at src/applications/calendar/parser/data/PhutilCalendarRecurrenceRule.php:592
throw new Exception(
pht(
'RRULE specifies BYMONTHDAY with FREQ set to WEEKLY, which '.
'violates RFC5545.'));
break;
default:
break;
}
}
if ($this->getByYearDay()) {
switch ($frequency) {
case self::FREQUENCY_DAILY:
case self::FREQUENCY_WEEKLY:
case self::FREQUENCY_MONTHLY:
// RFC5545: "The BYYEARDAY rule part MUST NOT be specified when the
// FREQ rule part is set to DAILY, WEEKLY, or MONTHLY."
throw new Exception(
pht(
'RRULE specifies BYYEARDAY with FREQ of DAILY, WEEKLY or '.
'MONTHLY, which violates RFC5545.'));
default:
break;
}
}
// TODO
// RFC5545: "The BYDAY rule part MUST NOT be specified with a numeric
// value when the FREQ rule part is not set to MONTHLY or YEARLY."
// RFC5545: "Furthermore, the BYDAY rule part MUST NOT be specified with a
// numeric value with the FREQ rule part set to YEARLY when the BYWEEKNO
// rule part is specified."
$date = $this->getStartDateTime();
View on GitHub (pinned to 5720a38cfe)
Solutions
- Change FREQ to YEARLY (the only frequency where BYYEARDAY is meaningful)
- Remove the BYYEARDAY part and express the intent with BYMONTH/BYMONTHDAY instead
- Pre-screen imported RRULEs for the forbidden BYYEARDAY + DAILY/WEEKLY/MONTHLY combinations
Example fix
// before $rrule = 'FREQ=MONTHLY;BYYEARDAY=100'; // after $rrule = 'FREQ=YEARLY;BYYEARDAY=100';
Defensive patterns
Strategy: validation
Validate before calling
$forbidden = array('DAILY', 'WEEKLY', 'MONTHLY');
if (isset($parts['BYYEARDAY']) && in_array(idx($parts, 'FREQ'), $forbidden, true)) {
throw new Exception('BYYEARDAY is not allowed with FREQ=DAILY/WEEKLY/MONTHLY.');
} Try / catch
try {
$rule = PhutilCalendarRecurrenceRule::newFromRRule($rrule);
$rule->getEvents();
} catch (Exception $ex) {
// Map to an import validation error for the offending .ics line.
} Prevention
- Maintain a compatibility table of FREQ x BY* parts and check rules against it on import
- Reject or drop unsupported combinations with a logged warning rather than storing failing rules
- Cover forbidden combinations in fixture-based .ics import tests
When it happens
Trigger: An RRULE such as 'FREQ=MONTHLY;BYYEARDAY=100', 'FREQ=DAILY;BYYEARDAY=1,366', or code calling setByYearDay(...) on a rule whose frequency is DAILY/WEEKLY/MONTHLY, followed by evaluation.
Common situations: Copy-pasted RRULE templates where FREQ was changed but BYYEARDAY kept; .ics producers that emit BYYEARDAY unconditionally; imports of rules authored against non-RFC tools.
Related errors
- RRULE BYDAY value "%s" has an offset with magnitude "%s", bu
- RRULE specifies BYMONTHDAY with FREQ set to WEEKLY, which vi
- Value "%s" in RRULE "%s" parameter is invalid: it must be be
- Value "%s" in RRULE "%s" parameter is invalid: it must not b
- RRULE specifies BYSETPOS with FREQ "%s", but this is invalid
AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21).
Data as JSON: /api/errors/dccf3d6b03f37419.
Report an issue: GitHub.