{"record":{"id":"0b54e0fb3bedeb59","repo":"actualbudget/actual","slug":"schedule-and-by-templates-must-be-the-same-priorit","errorCode":null,"errorMessage":"Schedule and By templates must be the same priority level. Fix by setting all Schedule and By templates to priority level ${lowestPriority}","messagePattern":"Schedule and By templates must be the same priority level\\. Fix by setting all Schedule and By templates to priority level (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/loot-core/src/server/budget/category-template-context.ts","lineNumber":515,"sourceCode":"          if (!scheduleNames.has(t.name.trim())) {\n            throw new Error(`Schedule ${t.name.trim()} does not exist`);\n          }\n        } else {\n          throw new Error('Schedule template has no scheduleId or name');\n        }\n      });\n    //find lowest priority\n    const lowestPriority = Math.min(\n      ...templates\n        .filter(t => t.type === 'schedule' || t.type === 'by')\n        .map(t => t.priority),\n    );\n    //warn if priority needs fixed\n    templates\n      .filter(t => t.type === 'schedule' || t.type === 'by')\n      .forEach(t => {\n        if (t.priority !== lowestPriority) {\n          throw new Error(\n            `Schedule and By templates must be the same priority level. Fix by setting all Schedule and By templates to priority level ${lowestPriority}`,\n          );\n          //t.priority = lowestPriority;\n        }\n      });\n    // check if the target date is past and not repeating\n    templates\n      .filter(t => t.type === 'by' || t.type === 'spend')\n      .forEach(t => {\n        const range = monthUtils.differenceInCalendarMonths(\n          `${t.month}`,\n          month,\n        );\n        if (range < 0 && !(t.repeat || t.annual)) {\n          throw new Error(\n            `Target month has passed, remove or update the target month`,\n          );\n        }","sourceCodeStart":497,"sourceCodeEnd":533,"githubUrl":"https://github.com/actualbudget/actual/blob/d4334cb6e6123f4d3bcea1ad6166608884c7e658/packages/loot-core/src/server/budget/category-template-context.ts#L497-L533","documentation":"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.","triggerScenarios":"`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.","commonSituations":"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.","solutions":["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)","Or remove the priority clause so templates use the default priority, keeping all schedule/by templates consistent"],"exampleFix":"// before (category A)\n#template schedule Paycheck priority 2\n// after\n#template schedule Paycheck priority 1","handlingStrategy":"validation","validationCode":"const prios = templates.filter(t => ['schedule','by'].includes(t.type)).map(t => t.priority);\nif (new Set(prios).size > 1) throw new Error(`Schedule/By priorities differ: ${[...new Set(prios)].join(',')}`);","typeGuard":null,"tryCatchPattern":"try {\n  await init();\n} catch (e) {\n  if (e.message.includes('must be the same priority level')) {\n    const target = Number(e.message.match(/priority level (\\d+)/)?.[1]);\n    // rewrite all schedule/by templates to priority ${target}\n  } else throw e;\n}","preventionTips":["Use one project-wide priority value for all schedule/by templates","Grep notes for `priority ` when adding a new schedule/by template","Prefer omitting the priority clause unless ordering is required"],"tags":["goal-templates","priority","schedule","validation"],"backgroundTag":"inconsistent-configuration","analyzedSha":"d4334cb6e6123f4d3bcea1ad6166608884c7e658","analyzedAt":"2026-08-29T01:02:11.213Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}