[Bug]: Template calculates amount differently depending on order of items in note #2405

Closed
opened 2026-02-28 20:12:59 -06:00 by GiteaMirror · 2 comments
Owner

Originally created by @SonicJoe on GitHub (Aug 20, 2025).

Verified issue does not already exist?

  • I have searched and found no existing issue

What happened?

I have a budget category for some home expenses. Things that are big enough I need to budget for, but not so big I want separate categories for. I ran into a funny issue when adding a new item. In the current month the original budgeted amount was $504.72. I added an additional item for 16.99 due in February of next year to the bottom of the list and when I overwrite the budget it dropped the budgeted amount for the current month to $187.74. The carried over balance from July is +$171.64.

However, if I add the new item to the middle of the list it reverts back to $504.72 due this month, which almost makes less sense. You would expect it to add $2 or $3, but its almost like its ignoring the new entry if its in the middle.

So, here's the original list that results in a $504.72 budgeted amount for this month (with +$171.64 carried over from July):

Item 1
#template-9 1425.00 by 2026-03 repeat every year
Item 2
#template-9 320.00 by 2025-07 repeat every 2 years
Item 3
#template-9 41.65 by 2025-08 repeat every 3 months
Item 4
#template-9 27.63 by 2025-08 repeat every 6 months

If I update it to this it reduces the budgeted amount for the month to $187.74:

Item 1
#template-9 1425.00 by 2026-03 repeat every year
Item 2
#template-9 320.00 by 2025-07 repeat every 2 years
Item 3
#template-9 41.65 by 2025-08 repeat every 3 months
Item 4
#template-9 27.63 by 2025-08 repeat every 6 months
Item 5
#template-9 16.99 by 2026-02 repeat every 6 months

If I instead put item 5 in the middle like this, it goes back up to $504.72:

Item 1
#template-9 1425.00 by 2026-03 repeat every year
Item 2
#template-9 320.00 by 2025-07 repeat every 2 years
Item 5
#template-9 16.99 by 2026-02 repeat every 6 months
Item 3
#template-9 41.65 by 2025-08 repeat every 3 months
Item 4
#template-9 27.63 by 2025-08 repeat every 6 months

I suspect its getting confused because of the different timeframes involved, but I can't follow the logic to figure out why such a drastic swing in amounts.

How can we reproduce the issue?

I created a new blank budget and used the same numbers as above (including the carry over amount from July) and got the same result, so this is easily reproducible by just inputting the items into a budget with templates enabled.

Where are you hosting Actual?

Docker

What browsers are you seeing the problem on?

Chrome

Operating System

Windows 11

Originally created by @SonicJoe on GitHub (Aug 20, 2025). ### Verified issue does not already exist? - [x] I have searched and found no existing issue ### What happened? I have a budget category for some home expenses. Things that are big enough I need to budget for, but not so big I want separate categories for. I ran into a funny issue when adding a new item. In the current month the original budgeted amount was $504.72. I added an additional item for 16.99 due in February of next year to the bottom of the list and when I overwrite the budget it dropped the budgeted amount for the current month to $187.74. The carried over balance from July is +$171.64. However, if I add the new item to the middle of the list it reverts back to $504.72 due this month, which almost makes less sense. You would expect it to add $2 or $3, but its almost like its ignoring the new entry if its in the middle. So, here's the original list that results in a $504.72 budgeted amount for this month (with +$171.64 carried over from July): Item 1 #template-9 1425.00 by 2026-03 repeat every year Item 2 #template-9 320.00 by 2025-07 repeat every 2 years Item 3 #template-9 41.65 by 2025-08 repeat every 3 months Item 4 #template-9 27.63 by 2025-08 repeat every 6 months If I update it to this it reduces the budgeted amount for the month to $187.74: Item 1 #template-9 1425.00 by 2026-03 repeat every year Item 2 #template-9 320.00 by 2025-07 repeat every 2 years Item 3 #template-9 41.65 by 2025-08 repeat every 3 months Item 4 #template-9 27.63 by 2025-08 repeat every 6 months Item 5 #template-9 16.99 by 2026-02 repeat every 6 months If I instead put item 5 in the middle like this, it goes back up to $504.72: Item 1 #template-9 1425.00 by 2026-03 repeat every year Item 2 #template-9 320.00 by 2025-07 repeat every 2 years Item 5 #template-9 16.99 by 2026-02 repeat every 6 months Item 3 #template-9 41.65 by 2025-08 repeat every 3 months Item 4 #template-9 27.63 by 2025-08 repeat every 6 months I suspect its getting confused because of the different timeframes involved, but I can't follow the logic to figure out why such a drastic swing in amounts. ### How can we reproduce the issue? I created a new blank budget and used the same numbers as above (including the carry over amount from July) and got the same result, so this is easily reproducible by just inputting the items into a budget with templates enabled. ### Where are you hosting Actual? Docker ### What browsers are you seeing the problem on? Chrome ### Operating System Windows 11
GiteaMirror added the buggoal templates labels 2026-02-28 20:12:59 -06:00
Author
Owner

@matt-fidd commented on GitHub (Aug 20, 2025):

Thanks for reporting this, it's very weird!

I've tested myself by getting rid of the priorities and just running them on a given month.

Image

Test budget for easier replication:

2025-08-20-Template Test.zip

@matt-fidd commented on GitHub (Aug 20, 2025): Thanks for reporting this, it's very weird! I've tested myself by getting rid of the priorities and just running them on a given month. <img width="720" height="191" alt="Image" src="https://github.com/user-attachments/assets/ce131968-322a-4006-afb4-93792f3ead6f" /> Test budget for easier replication: [2025-08-20-Template Test.zip](https://github.com/user-attachments/files/21906651/2025-08-20-Template.Test.zip)
Author
Owner

@SonicJoe commented on GitHub (Aug 21, 2025):

As a sanity check I added a new budget with the 5 items separated and I get $263.17 as the combined budgeted amount for all the items in August. So Set 2 is closest, though a little under.

I'm not sure if this is the logic the goal templates are supposed to follow, but the assumption I have been going on with multiple items in a single category is that it would be the same whether they are all together or not. If that assumption is wrong, I may have to create a lot more categories, but I was trying to consolidate some related things to keep the budget looking cleaner/simpler.

Image
@SonicJoe commented on GitHub (Aug 21, 2025): As a sanity check I added a new budget with the 5 items separated and I get $263.17 as the combined budgeted amount for all the items in August. So Set 2 is closest, though a little under. I'm not sure if this is the logic the goal templates are supposed to follow, but the assumption I have been going on with multiple items in a single category is that it would be the same whether they are all together or not. If that assumption is wrong, I may have to create a lot more categories, but I was trying to consolidate some related things to keep the budget looking cleaner/simpler. <img width="684" height="232" alt="Image" src="https://github.com/user-attachments/assets/7ec3087d-9c9d-482e-a2ce-468eb33f0508" />
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/actual#2405