That was indeed the problem. And you were right about me running into another issue.
In case it helps anyone else, the issue was getting an error like "Cannot multiply
a balance with an amount" and it was solved by simplifying my defined functions.
Turns out ledger supports ternary conditionals, so my defines went from
define bktmax = tag('BucketMax')
define pct = tag('IncomePercent')
define tax = tag('TaxRatio')
define budget_val = (a * -1 * (1 - tax) * pct * 0.8)
define bucket_remaining(act) = bktmax - account(act).total
define bucket_diff(act) = bucket_remaining(act) - budget_val
define bucket_filled(act) = (((abs(bucket_diff(act)) + bucket_diff(act)) / (2*(bucket_diff(act)))) * -1) + 1
define bucket_not_filled(act) = (bucket_filled(act) * -1) + 1
define post_amount(act) = (bucket_filled(act) * bucket_remaining(act)) + (bucket_not_filled(act) * budget_val)
To the following:
define bktmax = tag('BucketMax')
define pct = tag('IncomePercent')
define tax = tag('TaxRatio')
define budget_val = (a * -1 * (1 - tax) * pct * 0.8)
define bucket_remaining(act) = bktmax - account(act).total
define bucket_diff(act) = bucket_remaining(act) - budget_val
define post_amount(act) = (bucket_diff(act) < 0 ? bucket_remaining(act) : budget_val)
And the issue went away.