[GH-ISSUE #6081] [Bug]: Goal Templates Simple with Limit error #9537

Closed
opened 2026-04-10 19:49:35 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @totallynotjon on GitHub (Nov 6, 2025).
Original GitHub issue: https://github.com/actualbudget/actual/issues/6081

Verified issue does not already exist?

  • I have searched and found no existing issue

What happened?

A bug happened!

Simple templates with limits are not applying properly when a category has a positive balance, and already money spent is negative. In this situation the calculation seems nonsensical.

For example in a category starting with 50 in balance at beginning of month.
budgeted 0, spent -20, balance 30

apply template
#template 50 up to 50
results in NO CHANGE
budgeted 0, spent -20, balance 30

expected result would be
budgeted 20, spent -20, balance 50

apply template
#template 100 up to 100
results in
budgeted 50, spent -20, balance 80

expected result would be
budgeted 70, spent -20, balance 100

The miscalculations conform to balance + |spent| = limit. So spent money is subtracting from the amount available to be budgeted into the category.

I am unfamiliar with this particular codebase, but if anyone simply points me in the direction of where this is handled in this repo I can try to fix this myself & pr.

Reproduction details are below.

How can we reproduce the issue?

How can we reproduce the issue?

This can be reproduced by going to the previous month and adding a budget amount of 50 to a category
Add in income 1000 or just some reasonable number so that there is adequate budget for the templates to pull from
Go back to the current month
Add a transaction in that category for the current month of 20
(This should result in a negative spent, and positive balance on the category)
Add the template #template 100 by 100
Apply the template to the category via any means

See that only 50 is budgeted instead of 70.

Where are you hosting Actual?

Docker

What browsers are you seeing the problem on?

Chrome, Firefox

Operating System

Linux

Originally created by @totallynotjon on GitHub (Nov 6, 2025). Original GitHub issue: https://github.com/actualbudget/actual/issues/6081 ### Verified issue does not already exist? - [x] I have searched and found no existing issue ### What happened? A bug happened! Simple templates with limits are not applying properly when a category has a positive balance, and already money spent is negative. In this situation the calculation seems nonsensical. For example in a category starting with 50 in balance at beginning of month. budgeted 0, spent -20, balance 30 apply template #template 50 up to 50 results in NO CHANGE budgeted 0, spent -20, balance 30 expected result would be budgeted 20, spent -20, balance 50 apply template #template 100 up to 100 results in budgeted 50, spent -20, balance 80 expected result would be budgeted 70, spent -20, balance 100 The miscalculations conform to balance + |spent| = limit. So spent money is subtracting from the amount available to be budgeted into the category. I am unfamiliar with this particular codebase, but if anyone simply points me in the direction of where this is handled in this repo I can try to fix this myself & pr. Reproduction details are below. ### How can we reproduce the issue? How can we reproduce the issue? This can be reproduced by going to the previous month and adding a budget amount of 50 to a category Add in income 1000 or just some reasonable number so that there is adequate budget for the templates to pull from Go back to the current month Add a transaction in that category for the current month of 20 (This should result in a negative spent, and positive balance on the category) Add the template #template 100 by 100 Apply the template to the category via any means See that only 50 is budgeted instead of 70. ### Where are you hosting Actual? Docker ### What browsers are you seeing the problem on? Chrome, Firefox ### Operating System Linux
GiteaMirror added the bug label 2026-04-10 19:49:35 -05:00
Author
Owner

@totallynotjon commented on GitHub (Nov 6, 2025):

After thinking on this. It might just be how I am interpreting the intended functionality. This would be correct in calculating the amount to budget ignoring the existing expenses in the category.

My baseline expectation was for the template to apply based on the category balance as it currently is, not to be calculated based on the balance before the existing expenses were added.

This could be expected functionality and not a bug.

<!-- gh-comment-id:3498101206 --> @totallynotjon commented on GitHub (Nov 6, 2025): After thinking on this. It might just be how I am interpreting the intended functionality. This would be correct in calculating the amount to budget ignoring the existing expenses in the category. My baseline expectation was for the template to apply based on the category balance as it currently is, not to be calculated based on the balance before the existing expenses were added. This could be expected functionality and not a bug.
Author
Owner

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

No templates consider current month spending. All your examples look correct. Just add the spending back in and you are getting exactly your limit.

Templates wouldn't work right for people who are living paycheck to paycheck if they considered current month spending. So if your are trying to stay within $500 for groceries per month, then using #template up to 500 makes sense. But if you apply that template on the 3rd week of the month after your paycheck comes in, then you already have some spending in that category but don't want that spending to be included in the up to 500 per month calculation.

<!-- gh-comment-id:3498103620 --> @youngcw commented on GitHub (Nov 6, 2025): No templates consider current month spending. All your examples look correct. Just add the spending back in and you are getting exactly your limit. Templates wouldn't work right for people who are living paycheck to paycheck if they considered current month spending. So if your are trying to stay within $500 for groceries per month, then using `#template up to 500` makes sense. But if you apply that template on the 3rd week of the month after your paycheck comes in, then you already have some spending in that category but don't want that spending to be included in the up to 500 per month calculation.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/actual#9537