Under Federal law if a loan is non-recourse as determined by state law, it is not includable in income due to cancellation of debt. If your debt is cancelled it is considered income because when you took the loan out it was not income since you had an offsetting obligation to repay the debt. When the debt is forgiven the offsetting obligation is no longer present and the cancellation of debt becomes income.
Under California law, a purchase money obligation was considered non-recourse. That is if you used loan proceeds to purchase a home that was your principal residence and the proceeds went directly to escrow and then to the seller they loan was considered purchase money and was non-recourse. However, if it was not your principal residence or you refinanced the home it was no longer non-recourse. However, with the passing of SB 931. if you enter into an agreement with your first trust deed lender whereby they will accept a lesser payoff in a short sale, the loan remains non-recourse and the lender can only look to the property for repayment and not charge you a deficiency.