phacility/phabricator · error · Exception
RRULE FREQ "%s" is invalid. Valid frequencies are: %s.
Error message
RRULE FREQ "%s" is invalid. Valid frequencies are: %s.
What it means
Phabricator's RRULE implementation limits FREQ to the RFC 5545 frequencies SECONDLY, MINUTELY, HOURLY, DAILY, WEEKLY, MONTHLY, YEARLY. setFrequency() throws for anything else, including nonstandard tokens like FORTNIGHTLY, lowercase 'daily', or a missing/null FREQ.
Source
Thrown at src/applications/calendar/parser/data/PhutilCalendarRecurrenceRule.php:388
}
public function getUntil() {
return $this->until;
}
public function setFrequency($frequency) {
static $map = array(
self::FREQUENCY_SECONDLY => self::SCALE_SECONDLY,
self::FREQUENCY_MINUTELY => self::SCALE_MINUTELY,
self::FREQUENCY_HOURLY => self::SCALE_HOURLY,
self::FREQUENCY_DAILY => self::SCALE_DAILY,
self::FREQUENCY_WEEKLY => self::SCALE_WEEKLY,
self::FREQUENCY_MONTHLY => self::SCALE_MONTHLY,
self::FREQUENCY_YEARLY => self::SCALE_YEARLY,
);
if (empty($map[$frequency])) {
throw new Exception(
pht(
'RRULE FREQ "%s" is invalid. Valid frequencies are: %s.',
$frequency,
implode(', ', array_keys($map))));
}
$this->frequency = $frequency;
$this->frequencyScale = $map[$frequency];
return $this;
}
public function getFrequency() {
return $this->frequency;
}
public function getFrequencyScale() {
return $this->frequencyScale;View on GitHub (pinned to 5720a38cfe)
Solutions
- Express nonstandard intervals with a legal FREQ plus INTERVAL (BIWEEKLY -> WEEKLY with INTERVAL=2; FORTNIGHTLY likewise).
- Uppercase the token: strtoupper($freq) before setting.
- Reject RRULEs missing FREQ early in your import pipeline.
Example fix
// before
$rule->setFrequency('biweekly');
// after
$rule->setFrequency(PhutilCalendarRecurrenceRule::FREQUENCY_WEEKLY);
$rule->setInterval(2); Defensive patterns
Strategy: type-guard
Validate before calling
$frequencies = array('SECONDLY','MINUTELY','HOURLY','DAILY',
'WEEKLY','MONTHLY','YEARLY');
$freq = strtoupper(trim(idx($dict, 'FREQ', '')));
if (!in_array($freq, $frequencies, true)) {
// map common nonstandard tokens or reject the rule
if ($freq === 'BIWEEKLY' || $freq === 'FORTNIGHTLY') {
$dict['FREQ'] = 'WEEKLY';
$dict['INTERVAL'] = 2;
} else {
// reject: no FREQ we can honor
}
} Type guard
function isValidRruleFrequency($freq) {
return in_array(strtoupper(trim((string)$freq)),
array('SECONDLY','MINUTELY','HOURLY','DAILY','WEEKLY','MONTHLY','YEARLY'), true);
} Prevention
- Uppercase FREQ tokens before setting them.
- Express nonstandard frequencies as a legal FREQ plus INTERVAL.
- Reject RRULEs without a FREQ part at ingest.
When it happens
Trigger: setFrequency('BIWEEKLY'); a dict built from ICS with 'FREQ' => null (missing FREQ part); tokens not uppercased before use.
Common situations: Calendar producers emitting nonstandard frequencies; user-facing text like 'every two weeks' translated literally; case normalization skipped after storage.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- RRULE dictionary includes unknown key "%s". Expected keys ar
- Unexpected value "%s" in "%s" RULE property: expected an int
- Unexpected value "%s" in "%s" RRULE property: expected only
- Weekday "%s" is not a valid weekday constant. Valid constant
- RRULE COUNT value "%s" is invalid: count must be at least 1.
AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21).
Data as JSON: /api/errors/9af5e5e35f6cd982.
Report an issue: GitHub.