actualbudget/actual · error

Date is required

Error message

Date is required

What it means

After confirming a date condition exists, `createSchedule` checks `dateCond.value`. A date condition with a null/undefined value (a date condition with no actual date) cannot produce a next date, so creation is rejected.

Source

Thrown at packages/loot-core/src/server/schedules/app.ts:336

  await db.moveSchedule(id, targetId);
  return {};
}

export async function createSchedule({
  schedule = null,
  conditions = [],
}: {
  schedule?: Partial<ScheduleEntity> | null;
  conditions?: RuleConditionEntity[];
} = {}): Promise<ScheduleEntity['id']> {
  const scheduleId = schedule?.id || uuidv4();

  const { date: dateCond } = extractScheduleConds(conditions);
  if (dateCond == null) {
    throw new Error('A date condition is required to create a schedule');
  }
  if (dateCond.value == null) {
    throw new Error('Date is required');
  }

  const nextDate = getNextDate(dateCond);
  const nextDateRepr = nextDate ? toDateRepr(nextDate) : null;
  const scheduleFields = schedule && {
    ...schedule,
    name: normalizeScheduleName(schedule.name),
  };
  if (scheduleFields) {
    if (scheduleFields.name) {
      if (await checkIfScheduleExists(scheduleFields.name, scheduleId)) {
        throw new Error('Cannot create schedules with the same name');
      }
    }
  }

  // Create the rule here based on the info
  const ruleId = await insertRule({

View on GitHub (pinned to d4334cb6e6)

Solutions

  1. Set `value` on the date condition to a valid date string or recurring descriptor before calling createSchedule
  2. Pre-validate conditions: `dateCond != null && dateCond.value != null`
  3. Use `getNextDate`/the shared schedule helpers to sanity-check the value parses

Example fix

// before
{ field: 'date', op: 'isapprox', value: null }
// after
{ field: 'date', op: 'isapprox', value: { frequency: 'monthly', start: '2026-02-01' } }
Defensive patterns

Strategy: validation

Validate before calling

const dateCond = conditions.find(c => c.field === 'date');
if (!dateCond || dateCond.value == null) {
  throw new Error('Date condition must have a value before createSchedule');
}
await createSchedule({ conditions });

Type guard

function hasDateValue(c) {
  return c.field === 'date' && c.value != null &&
    (typeof c.value === 'string' || typeof c.value === 'object');
}

Try / catch

try {
  const id = await createSchedule({ conditions });
} catch (e) {
  if (e.message === 'Date is required') {
    logger.error('Date condition has no value', conditions);
  } else {
    throw e;
  }
}

Prevention

When it happens

Trigger: Calling `createSchedule` with a condition `{ field: 'date', op: 'isapprox' }` but no `value` (or `value: null`), e.g. building the schedule form payload before the user picked a date.

Common situations: UI/API flows that submit the schedule before the date picker resolves; integrations serializing conditions where the recurring descriptor was dropped.

Related errors


AI-assisted analysis of actualbudget/actual@d4334cb6e6 (2026-08-29). Data as JSON: /api/errors/bd1381da7df02313. Report an issue: GitHub.