Submitted by SpicyMeatball, also found by JCN (1, 2), nocoder, cccz, niroh, mojito_auditor, rbserver, klau5, santipu_, TheSchnilch, Byteblockers, kaden, and ether_sky
Incorrect debtCeiling value will prevent users from withdrawing Guild tokens out of the gauge.
If there is a loan in the gauge and user wants to decrement the weight, we need to check its ceiling first:
https://github.com/code-423n4/2023-12-ethereumcreditguild/blob/main/src/tokens/GuildToken.sol#L224-L231
 This is needed to ensure that loans are distributed between the gauges according to their weights and tolerance. This only matters if there are multiple gauges of the same type. If there is, only one gauge ceiling is limited by the hardcap and the minter buffer. 
 https://github.com/code-423n4/2023-12-ethereumcreditguild/blob/main/src/loan/LendingTerm.sol#L287
Unfortunately, debtCeiling(int256 gaugeWeightDelta) applies delta only to the gaugeWeight leaving totalWeight as-is:
https://github.com/code-423n4/2023-12-ethereumcreditguild/blob/main/src/loan/LendingTerm.sol#L270
Check this test case for GuildToken.t.sol, where the user is unable to withdraw tokens from the gauge even it its the only gauge of its type and ceiling should be unlimited.
Modify debtCeiling to act like a LendingTerm:
https://github.com/code-423n4/2023-12-ethereumcreditguild/blob/main/test/unit/tokens/GuildToken.t.sol#L27
run the test
Foundry
Apply delta to totalWeight as well:
https://github.com/code-423n4/2023-12-ethereumcreditguild/blob/main/src/loan/LendingTerm.sol#L270
Math
eswak (Ethereum Credit Guild) confirmed via duplicate issue #880
