actualbudget/actual · error

Schedule and By templates must be the same priority level. F

Error message

Schedule and By templates must be the same priority level. Fix by setting all Schedule and By templates to priority level ${lowestPriority}

What it means

All `schedule` and `by` templates in a budget must share one common priority level. During init the engine computes the lowest priority among them and throws if any schedule/by template has a different priority, instructing you to align them.

Source

Thrown at packages/loot-core/src/server/budget/category-template-context.ts:515

          if (!scheduleNames.has(t.name.trim())) {
            throw new Error(`Schedule ${t.name.trim()} does not exist`);
          }
        } else {
          throw new Error('Schedule template has no scheduleId or name');
        }
      });
    //find lowest priority
    const lowestPriority = Math.min(
      ...templates
        .filter(t => t.type === 'schedule' || t.type === 'by')
        .map(t => t.priority),
    );
    //warn if priority needs fixed
    templates
      .filter(t => t.type === 'schedule' || t.type === 'by')
      .forEach(t => {
        if (t.priority !== lowestPriority) {
          throw new Error(
            `Schedule and By templates must be the same priority level. Fix by setting all Schedule and By templates to priority level ${lowestPriority}`,
          );
          //t.priority = lowestPriority;
        }
      });
    // check if the target date is past and not repeating
    templates
      .filter(t => t.type === 'by' || t.type === 'spend')
      .forEach(t => {
        const range = monthUtils.differenceInCalendarMonths(
          `${t.month}`,
          month,
        );
        if (range < 0 && !(t.repeat || t.annual)) {
          throw new Error(
            `Target month has passed, remove or update the target month`,
          );
        }

View on GitHub (pinned to d4334cb6e6)

Solutions

  1. Change every schedule and by template's `priority N` clause so all use the same priority shown in the error message (the lowest one found)
  2. Or remove the priority clause so templates use the default priority, keeping all schedule/by templates consistent

Example fix

// before (category A)
#template schedule Paycheck priority 2
// after
#template schedule Paycheck priority 1
Defensive patterns

Strategy: validation

Validate before calling

const prios = templates.filter(t => ['schedule','by'].includes(t.type)).map(t => t.priority);
if (new Set(prios).size > 1) throw new Error(`Schedule/By priorities differ: ${[...new Set(prios)].join(',')}`);

Try / catch

try {
  await init();
} catch (e) {
  if (e.message.includes('must be the same priority level')) {
    const target = Number(e.message.match(/priority level (\d+)/)?.[1]);
    // rewrite all schedule/by templates to priority ${target}
  } else throw e;
}

Prevention

When it happens

Trigger: `checkByAndScheduleAndSpend` (init) finds at least one template of type 'schedule' or 'by' whose `priority` differs from the minimum priority of all such templates — e.g. `#template schedule X priority 1` in one category and `#template by Y priority 2` in another.

Common situations: Adding new schedule/by templates with a different `priority N` clause than existing ones; editing priority on one category but not the others; copying templates from another budget with different priorities.

Related errors


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