
115 Cal. Rptr.2d 386 (2002)
95 Cal. App.4th 259
The PEOPLE, Plaintiff and Respondent,
v.
Andrew Gary SCHLAGER, Defendant and Appellant. 
No.  C036624. 
Court of Appeal, Third District. 
January 16, 2002. 
Review Granted April 10, 2002. 
Deborah Prucha, Woodland, under appointment by the Court of Appeal, for Defendant and Appellant. 
Bill Lockyer, Attorney General, David P. Druliner, Chief Assistant Attorney General, Robert R. Anderson, Senior Assistant Attorney General, W. Scott Thorpe, Supervising Deputy Attorney General, Jane N. Kirkland, Deputy Attorney General, for Plaintiff and Respondent. 
HULL, J.
Defendant pleaded no contest to attempted second degree murder in violation of Penal Code sections 664/187, subdivision (a), arson in violation of Penal Code section 451, two counts of burglary in violation of Penal Code Section 459, three counts of *387 receiving stolen property in violation of Penal Code section 496, subdivision (a) and cultivation of marijuana in violation of Health & Safety Code section 11358. ( Subsequent undesignated statutory references are to the Penal Code.) 
On appeal, defendant contends only that the trial court violated section 654 because it "imposfed] punishments for multiple convictions arising out of an indivisible course of conduct."  The People argue the appeal should be dismissed because defendant failed to obtain a certificate of probable cause and his plea of no contest waived his section 654 claim.  We conclude that defendant's appeal must be dismissed due to his failure to obtain a certificate of probable cause. 

Facts and Procedural History
We take the facts from the probation report and the preliminary hearing transcript. 
During the night of February 16, 1999, defendant entered Timothy Sjostrom's house to commit a burglary.  During the burglary, defendant stabbed Sjostrom 19 times. 
That same night, defendant burglarized the office of E Z Credit Used Cars.  Defendant ransacked the building, threw papers from cabinets onto the floor, tipped over stacked cases, and broke things.  He piled loose papers on the floor of the storage area and lit them with a road flare.  Several items were stolen from the business during the robbery, including two hand-held video games, and two pairs of binoculars. 
When the defendant was arrested on February 18, his backpack contained one of the stolen video games, and the police later recovered one pair of the stolen binoculars from the defendant's brother. 
On April 15, 1999, the People filed an information, charging defendant with attempted first degree murder (§§ 664/187, subd. ( a)), first degree residential burglary (§ 459), second degree commercial burglary (§ 459), two counts of receiving stolen property (§ 496, subd. ( a)), and arson of a structure (§ 451, subd. ( c)).  The information alleged that, in the commission of the attempted murder, defendant used a deadly weapon (§ 12022, subd. ( b)) and inflicted great bodily injury (§ 12022.7, subd. ( a)).  The information alleged further that defendant inflicted great bodily injury during the course of the first degree burglary. (§  12022.7, subd. ( a).)  In a separate information filed the same day, the People alleged that defendant cultivated marijuana. ( Health & Saf. Code, § 11358.) 
On February 24, 2000, the parties appeared in court to place on the record a negotiated settlement of these and other criminal charges.  After being reminded by defense counsel, the People amended the information to reduce the attempted murder charge to attempted murder in the second degree.  The People further amended the complaint to make certain word changes to one of the counts alleging receipt of stolen property and to add an additional count of receipt of stolen property. 
Defendant then pleaded no contest to each of the charges, admitted each of the enhancements set forth in the amended information, and pleaded no contest to the separate information alleging cultivation of marijuana.  His plea was in conformance with the agreement that he would plead guilty to, or admit, those allegations and be sentenced to a maximum of 19 years in state prison as calculated in "Attachment 1A" to the written plea agreement.  The People also agreed to dismiss a pending complaint that alleged corporal injury to a spouse or cohabitant, a felony, (§ 273.5, *388 subd. ( a)) and two counts of cruelty to a child by inflicting injury, (§ 273a, subd. ( b)) both misdemeanors, and a further complaint alleging various traffic violations.  Defendant agreed to waive his rights under People v. Harvey (1979) 25 Cal.3d 754, 159 Cal. Rptr.  696, 602 P.2d 396.  Based on his plea, the court found a violation of probation in four other matters. 
The plea agreement stated: "I understand as a term and condition of this plea that I waive any direct appeal i may have, absent any appeal to sentencing error." ( Emphasis in original.) 
At the time of his plea, defendant did not object to separate sentences for the counts alleging receipt of stolen property nor did he mention his later claim that two of the receiving stolen property counts to which he pleaded no contest were subject to the provisions of section 654. 
On August 31, 2000, the trial court sentenced defendant to 19 years in state prison.  At the sentencing hearing, defendant objected to two of the agreed-to eight-month terms for receiving stolen property, arguing they had to be stayed in accordance with section 654.  The trial court disagreed.  Defendant appeals. 

Discussion

I

Certificate of Probable Cause
On our own motion, we requested supplemental briefing as to whether this appeal should be dismissed because defendant failed to obtain a certificate of probable cause pursuant to section 1237.5 or whether the appeal should be decided against him because the claim is deemed abandoned pursuant to former rule 412(b) of the California Rules of Court (now rule 4.412(b)).  We also requested supplemental briefing as to whether the appeal should be dismissed because defendant's notice of appeal failed to specify that the appeal has been taken pursuant to California Rule of Court, rule 31(d).  We granted defendant's motion to amend the notice of appeal to state that his appeal is taken solely on grounds, which occurred after entry of his plea, that do not challenge the validity of the plea. 
The first question before us is the consequence of defendant's failure to obtain a certificate of probable cause. 
Section 1237.5 provides: "No appeal shall be taken by the defendant from a judgment of conviction upon a plea of .. .  nolo contendere ..., except where both of the following are met: [¶] (a) The defendant has filed with the trial court a written statement, executed under oath or penalty of perjury showing reasonable constitutional, jurisdictional, or other grounds going to the legality of the proceedings. [¶] ( b) The trial court has executed and filed a certificate of probable cause for such appeal with the county clerk."  The purpose of this section is to "`discourage and weed out frivolous or vexatious appeals challenging convictions following guilty and nolo contendere pleas.'" ( People v. Young (2000) 77 Cal. App.4th 827, 832, 91 Cal.  Rptr.2d 916 (Young).) 
Rule 31(d) of the California Rules of Court provides an exception to the certificate requirement. " If the appeal from a judgment of conviction entered upon a plea of guilty or nolo contendere is based solely upon grounds (1) occurring after entry of the plea which do not challenge its validity ..., the provisions of section 1237.5 of the Penal Code requiring a statement by the defendant and a certificate of probable cause by the trial court are inapplicable, but the appeal shall not be operative *389 unless the notice of appeal states that it is based upon such grounds."  As noted earlier we granted defendant's motion to amend the notice of appeal.  Thus, a probable cause certificate is not required, if the grounds for defendant's appeal arose after he entered his plea and do not challenge the validity of his no contest plea. 
In People v. Panizzon (1996) 13 Cal.4th 68, 73, 51 Cal. Rptr.2d 851, 913 P.2d 1061 (Panizzon), the defendant agreed to enter a plea of no contest to one count of kidnapping for ransom and agreed to a sentence of life with the possibility of parole, plus 12 years.  Defendant filed a notice of appeal without first obtaining a certificate of probable cause, arguing his sentence violated the federal and state constitutional prohibitions against cruel and unusual punishment. ( Id. at p. 74, 51 Cal. Rptr.2d 851, 913 P.2d 1061.)  Our Supreme Court held that defendant's challenge to his sentence was, in actuality, a challenge to his plea and was thus barred by section 1237.5. ( Panizzon, supra, 13 Cal.4th at pp.  78, 89, 51 Cal. Rptr.2d 851, 913 P.2d 1061.)  The court explained: "In determining whether section 1237.5 applies to a challenge of a sentence imposed after a plea of guilty or no contest, courts must look to the substance of the appeal: `the crucial issue is what the defendant is challenging, not the time or manner in which the challenge is made.' [ Citation.]  Hence, the critical inquiry is whether a challenge to the sentence is in substance a challenge to the validity of the plea, thus rendering the appeal subject to the requirements of section 1237.5." ( Panizzon, supra, at p. 76, 51 Cal. Rptr.2d 851, 913 P.2d 1061, italics in original.)  The court concluded that a challenge to a negotiated sentence imposed as part of the plea agreement is properly viewed as a challenge to the validity of the plea. ( Id. at p. 79, 51 Cal. Rptr .2d 851, 913 P.2d 1061.)  Such a challenge may not be maintained without obtaining a certificate of probable cause. ( Ibid.) 
In Young, supra, 77 Cal. App.4th 827, 91 Cal. Rptr.2d 916, we examined the impact of Panizzon on a defendant who received the maximum sentence he was promised in his plea agreement.  In exchange for a plea of guilty, defendant was promised that his maximum sentence would be 25 years to life and that he would have the opportunity to ask the court to strike one or more of his prior convictions. ( Id. at p. 830, 91 Cal. Rptr.2d 916.)  The trial court refused to strike any of the convictions and sentenced defendant to 25 years to life. ( Ibid.)  On appeal, defendant argued his sentence constituted cruel and unusual punishment, but he did not argue that the trial court abused its discretion in refusing to strike his prior convictions. ( Ibid.)  We concluded, "defendant in this case is attacking the validity of his plea.  The prosecution agreed to a maximum sentence of 25 years to life in return for defendant's plea.  Yet, defendant now attacks that maximum sentence on the ground that it is cruel and unusual punishment.  By arguing that the maximum sentence is unconstitutional, he is arguing that part of his plea bargain is illegal and is thus attacking the validity of the plea.  Having failed to obtain a certificate of probable cause, defendant cannot appeal." ( Id, at p. 832, 91 Cal. Rptr.2d 916.)  We further rejected the defendant's argument that Panizzon did not apply because defendant agreed only to the maximum sentence not a particular sentence. ( Ibid.) 
As required by Panizzon, we look to the substance of defendant's appeal and exactly that which defendant is challenging. 
The attachment to the written plea agreement sets forth each of the counts and the enhancements alleged in the information as amended immediately prior to defendant's change of plea.  The amendments *390 were made, obviously, to conform to the agreement the parties had reached, an agreement that contemplated a maximum of 19 years in prison.  While the attachment to the information purported to set forth "maximums" for each offense and each enhancement, it plainly did not do so.  Rather it stated the maximum sentence for attempted second degree murder and the sentence required by each of the enhancements defendant admitted.  As to the remaining substantive offenses to which the defendant pleaded guilty, the attachment stated a subordinate term of one-third the midterm sentence as to each.  The attachment noted that the second enhancement under section 12022.7, subdivision (a) had to be stayed at the time of sentencing.  Totaled, the terms added to 19 years, not counting the year that the parties agreed had to be stayed.  It is apparent that the People amended the information and agreed to dismiss other charges as part of an agreement that resolved all of the criminal charges then outstanding against the defendant and that both the People and the defendant agreed that, in return for the People's concessions, defendant could be sent to prison for up to 19 years.  The 19-year term depended in part on a calculation that sentenced defendant separately and consecutively for each of the two charges that he now challenges pursuant to section 654. 
Thus, pursuant to an agreement with the People, defendant pleaded no contest to charges specifically tailored to add to a total of 19 years.  This was stated as a maximum plea no doubt to accommodate the possibility that the sentencing court might agree to sentence defendant to something less than the aggravated term on the attempted second degree murder count.  But to the extent his argument for less than a 19-year sentence sought to reduce his sentence by invoking the provisions of section 654, he was attacking his plea to those two counts. 
Moreover, the sentencing matrix of Attachment 1A set forth a specified term for the two counts of receiving stolen property that defendant now challenges, that is, for a term of eight months on each to be served consecutively.  By specifically, and without objection, pleading to the two counts with their separate specified terms of eight months each and then seeking to negate his plea to those counts at the time of sentencing, defendant attempts to renege on his plea to those two counts and on the plea agreement in general.  It follows that his appeal asserting that the trial court erred by considering and sentencing on the two counts as they were set forth in the plea agreement is an attack on his plea. 
Defendant may reply that the reason he entered his pleas and agreed to a maximum of 19 years was, in part, with the expectation that his section 654 argument necessarily would reduce the maximum sentence and that the court's refusal to accept that argument occurred after he entered his plea.  But defendant cannot be permitted to enter into a plea agreement acknowledging that these two counts and their attendant agreed sentences should be included in computing the maximum sentence and then later argue that they should not.  Even if section 654 would normally have precluded separate punishment for the two counts of receiving stolen property, defendant must be deemed to have agreed at the time of his plea that separate consecutive sentences on those counts were legal under the terms of this particular agreement. 
Defendant's effort here is no different functionally than that of a defendant who pleads to certain counts and then claims the sentence that attaches to those counts is illegal because it constitutes cruel and *391 unusual punishment.  Both seek to improve an agreement by claiming the consequences of that agreement are illegal.  Both constitute a disguised attack on the plea and neither can be made without a certificate of probable cause.  Defendant's appeal must be dismissed. 

Disposition
Defendant's appeal is dismissed for failure to comply with the provisions of Penal Code section 1237.5. 
We concur: SIMS, Acting P.J., and DAVIS, J.
