[GH-ISSUE #6030] [Bug]: Multiple "#template by x repeat every y" lines in same category notes calculate incorrect total budget amount #28372

Open
opened 2026-04-18 05:06:05 -05:00 by GiteaMirror · 11 comments
Owner

Originally created by @ditmarvisser on GitHub (Oct 30, 2025).
Original GitHub issue: https://github.com/actualbudget/actual/issues/6030

Verified issue does not already exist?

  • I have searched and found no existing issue

What happened?

I'm experiencing a bug with template calculations when multiple "#template by x repeat every y" lines are in the same category. The budgeted amount behaves incorrectly, and strangely actually increases when I remove items. The individual template calculations appear correct when isolated, but the combined calculation in a single category produces incorrect results.

I am using Actual 25.10.0, hosted with docker on my own server. I did not find any other bug reports mentioning this exact issue, but maybe #5585 is related?

How can we reproduce the issue?

I always use override with budget template to be sure.

  1. Create a new empty category with the following templates in the notes field:
A
#template-3 800 by 2033-01 repeat every 7 years

B
#template-3 700 by 2033-01 repeat every 7 years

C
#template-3 200 by 2026-03 repeat every 5 years

D
#template-3 80 by 2030-01 repeat every 4 years

E
#template-3 1000 by 2030-01 repeat every 10 years

F
#template-3 400 by 2025-12 repeat every 5 years

G
#template-3 2000 by 2030-01 repeat every 10 years
  1. Run templates in 2025-10
  2. Budgeted amount becomes €781.83

When I run the templates individually i get these amounts:

  • A: €9.09
  • B: €7.95
  • C: €33.33
  • D: €1.54
  • E: €19.23
  • F: €133.33
  • G: €38.46
  • Expected total: €242.93
  1. When removing the A template (keeping B-G), Actual budgets €785.00
  2. When removing A and B templates (keeping C-G), actual budgets €787.78

Where are you hosting Actual?

Docker

What browsers are you seeing the problem on?

Firefox

Operating System

None

Originally created by @ditmarvisser on GitHub (Oct 30, 2025). Original GitHub issue: https://github.com/actualbudget/actual/issues/6030 ### Verified issue does not already exist? - [x] I have searched and found no existing issue ### What happened? I'm experiencing a bug with template calculations when multiple "#template by x repeat every y" lines are in the same category. The budgeted amount behaves incorrectly, and strangely actually increases when I remove items. The individual template calculations appear correct when isolated, but the combined calculation in a single category produces incorrect results. I am using Actual 25.10.0, hosted with docker on my own server. I did not find any other bug reports mentioning this exact issue, but maybe #5585 is related? ### How can we reproduce the issue? I always use override with budget template to be sure. 1. Create a new empty category with the following templates in the notes field: ``` A #template-3 800 by 2033-01 repeat every 7 years B #template-3 700 by 2033-01 repeat every 7 years C #template-3 200 by 2026-03 repeat every 5 years D #template-3 80 by 2030-01 repeat every 4 years E #template-3 1000 by 2030-01 repeat every 10 years F #template-3 400 by 2025-12 repeat every 5 years G #template-3 2000 by 2030-01 repeat every 10 years ``` 2. Run templates in 2025-10 3. Budgeted amount becomes €781.83 When I run the templates individually i get these amounts: - A: €9.09 - B: €7.95 - C: €33.33 - D: €1.54 - E: €19.23 - F: €133.33 - G: €38.46 - Expected total: €242.93 4. When removing the A template (keeping B-G), Actual budgets €785.00 5. When removing A and B templates (keeping C-G), actual budgets €787.78 ### Where are you hosting Actual? Docker ### What browsers are you seeing the problem on? Firefox ### Operating System None
GiteaMirror added the goal templatesbug labels 2026-04-18 05:06:05 -05:00
Author
Owner

@matt-fidd commented on GitHub (Oct 30, 2025):

Sounds similar to https://github.com/actualbudget/actual/issues/5585 as you've said. The usual advice here is to split some templates into different categories where possible. There's a lot of complicated maths under the hood for the templates and having this many conditions can make it wonky sometimes.

cc @youngcw in case he has any ideas for patches here, but moving them into different categories is almost definitely your best bet

<!-- gh-comment-id:3469580654 --> @matt-fidd commented on GitHub (Oct 30, 2025): Sounds similar to https://github.com/actualbudget/actual/issues/5585 as you've said. The usual advice here is to split some templates into different categories where possible. There's a lot of complicated maths under the hood for the templates and having this many conditions can make it wonky sometimes. cc @youngcw in case he has any ideas for patches here, but moving them into different categories is almost definitely your best bet
Author
Owner

@youngcw commented on GitHub (Nov 4, 2025):

Ill see if I can find anything but many by templates together make the math really complicated. The core of the issue is how much of the balance applies to each of the templates? There is no good way to know, so the math predicts how much should be budgeted at the next due date of any of the lines and uses that for the calculations.

The best way to handle many by templates that have very different amounts, periods, and due dates, is to use separate categories.

<!-- gh-comment-id:3486345077 --> @youngcw commented on GitHub (Nov 4, 2025): Ill see if I can find anything but many by templates together make the math really complicated. The core of the issue is how much of the balance applies to each of the templates? There is no good way to know, so the math predicts how much should be budgeted at the next due date of any of the lines and uses that for the calculations. The best way to handle many by templates that have very different amounts, periods, and due dates, is to use separate categories.
Author
Owner

@youngcw commented on GitHub (Nov 4, 2025):

@ditmarvisser Templates E and G are your trouble makers. Because those are so big, and nothing has been budgeted for them so far, the templates are expecting to see ~1500 budgeted at the end of the year so are budgeting a bunch right now.

<!-- gh-comment-id:3486392799 --> @youngcw commented on GitHub (Nov 4, 2025): @ditmarvisser Templates E and G are your trouble makers. Because those are so big, and nothing has been budgeted for them so far, the templates are expecting to see ~1500 budgeted at the end of the year so are budgeting a bunch right now.
Author
Owner

@youngcw commented on GitHub (Nov 4, 2025):

2025-11-04-By stack test.zip

This file creates this situation.

<!-- gh-comment-id:3486437724 --> @youngcw commented on GitHub (Nov 4, 2025): [2025-11-04-By stack test.zip](https://github.com/user-attachments/files/23338820/2025-11-04-By.stack.test.zip) This file creates this situation.
Author
Owner

@Zarklord commented on GitHub (Nov 28, 2025):

I just want to add that this is a deal breaker of an issue for me, given that it's sometimes buggy when using multiple templates together, as far as I'm concerned that means actual doesn't support multiple templates for a single category.

if I can't trust that my budgeting software is doing the math correctly I can't use it.

<!-- gh-comment-id:3590093118 --> @Zarklord commented on GitHub (Nov 28, 2025): I just want to add that this is a deal breaker of an issue for me, given that it's sometimes buggy when using multiple templates together, as far as I'm concerned that means actual doesn't support multiple templates for a single category. if I can't trust that my budgeting software is doing the math correctly I can't use it.
Author
Owner

@Juulz commented on GitHub (Nov 28, 2025):

Interesting, when I ran them in the demo without the repeats they worked fine.

Image
<!-- gh-comment-id:3590234632 --> @Juulz commented on GitHub (Nov 28, 2025): Interesting, when I ran them in the demo without the repeats they worked fine. <img width="715" height="217" alt="Image" src="https://github.com/user-attachments/assets/f669b9e6-9600-4037-bcc0-48b8d4f61473" />
Author
Owner

@vfhykrmh4k-dot commented on GitHub (Jan 9, 2026):

Bug Report: Template Engine: Multi-line 'By Date' templates causing math "bleed" between multiple dates

I am experiencing a similar issue related to the logic issues discussed in #6030.

Issue: Multiple "By Date" templates fight over the balance

When stacking multiple #template [amount] by [date] lines in a single category, the engine fails to silo the balance for each line.

The Setup:

  • #template 30 by 2026-02
  • #template 210 by 2026-03
  • #template 210 by 2026-03
    (Assuming $15 spent each month in Jan/Feb)
Month Expected Budget Actual Budget Logic Error Status
Jan $155.00 $155.00 Correct
Feb $155.00 $100.00 Dip: Applies Jan balance to all lines
Mar $140.00 $195.00 Spike: Panics to hit final total
TOTAL $450.00 $450.00 Math settles, but monthly flow is broken

The engine should treat the balance for each line independently. Currently, the shared balance causes the "By Date" calculations to under-budget in mid-cycle months.


Why I am reporting this instead of splitting categories

While splitting these into separate categories is a common workaround, it creates significant UI clutter for those with many annual renewals. Since the #template system supports multiple lines, the logic should be able to handle them without this balance bleed.

I would prefer to use and stack #template schedules but there is a bug with this template see here

<!-- gh-comment-id:3730001664 --> @vfhykrmh4k-dot commented on GitHub (Jan 9, 2026): ### Bug Report: Template Engine: Multi-line 'By Date' templates causing math "bleed" between multiple dates I am experiencing a similar issue related to the logic issues discussed in **#6030**. #### Issue: Multiple "By Date" templates fight over the balance When stacking multiple `#template [amount] by [date]` lines in a single category, the engine fails to silo the balance for each line. **The Setup:** * `#template 30 by 2026-02` * `#template 210 by 2026-03` * `#template 210 by 2026-03` *(Assuming $15 spent each month in Jan/Feb)* | Month | Expected Budget | Actual Budget | Logic Error Status | |---|---|---|---| | Jan | $155.00 | $155.00 | Correct | | Feb | $155.00 | $100.00 | Dip: Applies Jan balance to all lines | | Mar | $140.00 | $195.00 | Spike: Panics to hit final total | | **TOTAL** | **$450.00** | **$450.00** | Math settles, but monthly flow is broken | The engine should treat the balance for each line independently. Currently, the shared balance causes the "By Date" calculations to under-budget in mid-cycle months. --- #### Why I am reporting this instead of splitting categories While splitting these into separate categories is a common workaround, it creates significant UI clutter for those with many annual renewals. Since the `#template` system supports multiple lines, the logic should be able to handle them without this balance bleed. I would prefer to use and stack #template schedules but there is a bug with this template [see here](https://github.com/actualbudget/actual/issues/6513#issuecomment-3730453529)
Author
Owner

@vfhykrmh4k-dot commented on GitHub (Jan 9, 2026):

Interesting, when I ran them in the demo without the repeats they worked fine.

Image

I noticed this also when removing the "repeat" syntax, but if you run the template the following month and onwards the math goes back to being wonky.

<!-- gh-comment-id:3730103118 --> @vfhykrmh4k-dot commented on GitHub (Jan 9, 2026): > Interesting, when I ran them in the demo without the repeats they worked fine. > > <img alt="Image" width="715" height="217" src="https://private-user-images.githubusercontent.com/29179457/520292579-f669b9e6-9600-4037-bcc0-48b8d4f61473.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Njc5ODM1MTIsIm5iZiI6MTc2Nzk4MzIxMiwicGF0aCI6Ii8yOTE3OTQ1Ny81MjAyOTI1NzktZjY2OWI5ZTYtOTYwMC00MDM3LWJjYzAtNDhiOGQ0ZjYxNDczLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjAxMDklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwMTA5VDE4MjY1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWQxZTE2MzE4NmI0OGI5OTY2OTU1ZTA3YWRjNDcxZmQ3Yjg4OTBhNTk5YzAzYTZkMzk1MTRkY2MyMzIzMDI4OTAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.oT1sCdYBWGtaZ_k3GzYimaTVU5oxwocXtM5K3LK16yg"> I noticed this also when removing the "repeat" syntax, but if you run the template the following month and onwards the math goes back to being wonky.
Author
Owner

@vfhykrmh4k-dot commented on GitHub (Jan 9, 2026):

I just want to add that this is a deal breaker of an issue for me, given that it's sometimes buggy when using multiple templates together, as far as I'm concerned that means actual doesn't support multiple templates for a single category.

if I can't trust that my budgeting software is doing the math correctly I can't use it.

Agree, if #schedule template could be fixed as discussed in #6513 I would be using that rather. Not sure if that would be an easier fix than the issue at hand here?

<!-- gh-comment-id:3730130136 --> @vfhykrmh4k-dot commented on GitHub (Jan 9, 2026): > I just want to add that this is a deal breaker of an issue for me, given that it's sometimes buggy when using multiple templates together, as far as I'm concerned that means actual doesn't support multiple templates for a single category. > > if I can't trust that my budgeting software is doing the math correctly I can't use it. Agree, if #schedule template could be fixed as discussed in #6513 I would be using that rather. Not sure if that would be an easier fix than the issue at hand here?
Author
Owner

@Juulz commented on GitHub (Jan 9, 2026):

Interesting, when I ran them in the demo without the repeats they worked fine.
Image

I noticed this also when removing the "repeat" syntax, but if you run the template the following month and onwards the math goes back to being wonky.

I stopped stacking "By" templates for this reason. I found that I was underbudget after about 6 months or so. I don't want to make separate categories for each service, so I use a spreadsheet to track TV Streaming and Subscriptions, among other things. I export transactions every month and use pivot tables to view my data and make future budgeting decisions.

As templates are still experimental, I'm happy with some workarounds.

<!-- gh-comment-id:3730171507 --> @Juulz commented on GitHub (Jan 9, 2026): > > Interesting, when I ran them in the demo without the repeats they worked fine. > > <img alt="Image" width="715" height="217" src="https://private-user-images.githubusercontent.com/29179457/520292579-f669b9e6-9600-4037-bcc0-48b8d4f61473.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Njc5ODM1MTIsIm5iZiI6MTc2Nzk4MzIxMiwicGF0aCI6Ii8yOTE3OTQ1Ny81MjAyOTI1NzktZjY2OWI5ZTYtOTYwMC00MDM3LWJjYzAtNDhiOGQ0ZjYxNDczLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjAxMDklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwMTA5VDE4MjY1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWQxZTE2MzE4NmI0OGI5OTY2OTU1ZTA3YWRjNDcxZmQ3Yjg4OTBhNTk5YzAzYTZkMzk1MTRkY2MyMzIzMDI4OTAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.oT1sCdYBWGtaZ_k3GzYimaTVU5oxwocXtM5K3LK16yg"> > > I noticed this also when removing the "repeat" syntax, but if you run the template the following month and onwards the math goes back to being wonky. I stopped stacking "By" templates for this reason. I found that I was underbudget after about 6 months or so. I don't want to make separate categories for each service, so I use a spreadsheet to track TV Streaming and Subscriptions, among other things. I export transactions every month and use pivot tables to view my data and make future budgeting decisions. As templates are still experimental, I'm happy with some workarounds.
Author
Owner

@vfhykrmh4k-dot commented on GitHub (Jan 9, 2026):

Interesting, when I ran them in the demo without the repeats they worked fine.
Image

I noticed this also when removing the "repeat" syntax, but if you run the template the following month and onwards the math goes back to being wonky.

I stopped stacking "By" templates for this reason. I found that I was underbudget after about 6 months or so. I don't want to make separate categories for each service, so I use a spreadsheet to track TV Streaming and Subscriptions, among other things. I export transactions every month and use pivot tables to view my data and make future budgeting decisions.

As templates are still experimental, I'm happy with some workarounds.

Most definitely not a complaint, just some feedback that will hopefully help the developers. I totally accept that the template feature is still in the development phase. Absolutely love AB for it's flexibility and functions coming from using Excel for budgeting.

<!-- gh-comment-id:3730233295 --> @vfhykrmh4k-dot commented on GitHub (Jan 9, 2026): > > > Interesting, when I ran them in the demo without the repeats they worked fine. > > > <img alt="Image" width="715" height="217" src="https://private-user-images.githubusercontent.com/29179457/520292579-f669b9e6-9600-4037-bcc0-48b8d4f61473.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Njc5ODM1MTIsIm5iZiI6MTc2Nzk4MzIxMiwicGF0aCI6Ii8yOTE3OTQ1Ny81MjAyOTI1NzktZjY2OWI5ZTYtOTYwMC00MDM3LWJjYzAtNDhiOGQ0ZjYxNDczLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjAxMDklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwMTA5VDE4MjY1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWQxZTE2MzE4NmI0OGI5OTY2OTU1ZTA3YWRjNDcxZmQ3Yjg4OTBhNTk5YzAzYTZkMzk1MTRkY2MyMzIzMDI4OTAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.oT1sCdYBWGtaZ_k3GzYimaTVU5oxwocXtM5K3LK16yg"> > > > > > > I noticed this also when removing the "repeat" syntax, but if you run the template the following month and onwards the math goes back to being wonky. > > I stopped stacking "By" templates for this reason. I found that I was underbudget after about 6 months or so. I don't want to make separate categories for each service, so I use a spreadsheet to track TV Streaming and Subscriptions, among other things. I export transactions every month and use pivot tables to view my data and make future budgeting decisions. > > As templates are still experimental, I'm happy with some workarounds. Most definitely not a complaint, just some feedback that will hopefully help the developers. I totally accept that the template feature is still in the development phase. Absolutely love AB for it's flexibility and functions coming from using Excel for budgeting.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/actual#28372