There are two sections of the California Probate Code that permit modification of an otherwise irrevocable trust:
Probate Code §15403, which provides as follows:
Probate Code 15403. (a) Except as provided in subdivision (b), if all beneficiaries of an irrevocable trust consent, they may compel modification or termination of the trust upon petition to the court.
(b) If the continuance of the trust is necessary to carry out a material purpose of the trust, the trust cannot be modified or terminated unless the court, in its discretion, determines that the reason for doing so under the circumstances outweighs the interest in accomplishing a material purpose of the trust. Under this section the court does not have discretion to permit termination of a trust that is subject to a valid restraint on transfer of the beneficiary’s interest as provided in Chapter 2 (commencing with Section 15300).
Note that in the case of a Bypass Trust or Marital QTIP Trust, the beneficiaries will typically be the Surviving Spouse and the remainder beneficiaries of one or both trusts.
Probate Code §15409, which provides as follows:
Probate Code 15409. (a) On petition by a trustee or beneficiary, the court may modify the administrative or dispositive provisions of the trust or terminate the trust if, owing to circumstances not known to the settlor and not anticipated by the settlor, the continuation of the trust under its terms would defeat or substantially impair the accomplishment of the purposes of the trust. In this case, if necessary to carry out the purposes of the trust, the court may order the trustee to do acts that are not authorized or are forbidden by the trust instrument.
(b) The court shall consider a trust provision restraining transfer of the beneficiary s interest as a factor in making its decision whether to modify or terminate the trust, but the court is not precluded from exercising its discretion to modify or terminate the trust solely because of a restraint on transfer.
Note that this provision would be used if there are one or more provisions of an irrevocable trust that only some of the beneficiaries wish to have modified, and the modifications would not affect the interests of the beneficiaries who do not consent.