
131 Cal.Rptr.2d 834 (2003)
107 Cal.App.4th 188
The PEOPLE, Plaintiff and Respondent,
v.
Glen Everrette MAGEE, Defendant and Appellant.
No. F039784.
Court of Appeal, Fifth District.
March 20, 2003.
Review Denied June 11, 2003.[*]
Certiorari Denied November 10, 2003.
*835 Jerome P. Wallingford, under appointment by the Court of Appeal, for Defendant and Appellant.
Bill Lockyer, Attorney General, Robert R. Anderson, Chief Assistant Attorney General, Jo Graves, Assistant Attorney General, J. Robert Jibson and Judy Kaida, Deputy Attorneys General, for Plaintiff and Respondent.
Certiorari Denied November 10, 2003. See 124 S.Ct. 536.

OPINION
CORNELL, J.
Glen Everrette Magee was convicted of being an accessory to the robbery of Douglas N. (Pen.Code § 32.)[1] The issue presented is whether the jury was properly instructed and, if not, the appropriate standard of review.
The jury was instructed that the People were required to prove that a felony occurred, in this case a robbery. However, the trial court, with the agreement of both trial counsel, did not instruct the jury with the elements of robbery, thus leaving the jury with no means of determining whether the People proved all of the statutory elements of a robbery.
We conclude that this failure violated Magee's right to have the jury find beyond a reasonable doubt every element of the crime as required by the due process clause of the Constitution. (In re Winship (1970) 397 U.S. 358, 364, 90 S.Ct. 1068, 25 L.Ed.2d 368.) Our conclusion is contrary to the decision issued by the Fourth District in People v. Shields (1990) 222 Cal. App.3d 1, 271 Cal.Rptr. 228.
*836 We also conclude that this error is subject to the harmless error analysis of Chapman v. California (1967) 386 U.S. 18, 87 S.Ct. 824, 17 L.Ed.2d 705, and, in this case, the error was harmless beyond a reasonable doubt.

FACTUAL AND PROCEDURAL SUMMARY
The facts of this case are undisputed. Douglas N. was riding his bicycle with a friend, Jerrardo M., when they were passed by a pickup. Magee was driving the pickup and Christopher A. and Angel R. were the passengers. The pickup turned in front of Douglas and Jerrardo and disappeared from sight. A short while later, Christopher A. and Angel R. were walking down the street. As Douglas N. rode by, Christopher A. knocked him off his bicycle and took his cellular phone. Christopher A. and Angel R. jogged away and were spotted leaving the area in the pickup with Magee.
Magee did not dispute any of the above facts but argued that he had no knowledge that a robbery had occurred and, therefore, could not be an accessory to the crime. The jury disagreed. Magee was sentenced to five years' probation.

DISCUSSION
As stated above, the only issue relates to jury instructions. The jury was instructed with CALJIC No. 6.40, which provides, inter alia, that the elements of the offense of being an accessory after the fact include the requirement that the People prove that a felony, in this case robbery, was committed.[2] The People originally requested that the trial court instruct the jury with CALJIC No. 9.40, which defines the elements of a robbery, but later withdrew that request with the consent of Magee's counsel.
Magee contends that it was error not to instruct the jury on the elements of robbery since it was left without the ability to determine if a felony occurred, an essential element to a section 32 violation. Furthermore, he contends the failure to instruct on each element of the crime is a structural error in the trial, which requires reversal without any need to determine if the error was prejudicial.
The People assert it is unnecessary to instruct on the elements of the underlying felony when it is undisputed the crime occurred, citing People v. Shields, supra, 222 Cal.App.3d at p. 1, 271 Cal.Rptr. 228. Magee acknowledges Shields, but claims it was wrongly decided.
In Shields, the defendant was charged with being an accessory to the beating death of her child. The jury was instructed with CALJIC No. 6.40, but the trial court failed to instruct the jury with the elements of the underlying offense, murder. The appellate court analogized the situation to the failure to define great bodily injury in a section 245 prosecution.

*837 "We find the analogy persuasive here. All that was needed was proof that a felony had been committed. While that felony was defined in the instruction as murder, the jury was not required to find a technical first degree murder in order to convict defendant of being an accessory to a felony. The uncontradicted evidence was that [the baby] died of 'multiple injuries by assailant(s).' There was no doubt that a felony, probably murder, had been committed, and defendant did not contend otherwise. There is no suggestion in the record that the jury was confused on this issue nor does defendant argue that the jury was actually misled. While defendant could have properly requested further instructions on this issue, we find that the trial court had no duty to give such instructions sua sponte." (People v. Shields, supra, 222 Cal.App.3d at p. 5, 271 Cal.Rptr. 228.)
As we shall explain, while we agree that Shields reached the correct result, we find its reasoning flawed.
The Fifth and Sixth Amendments to the United States Constitution require that every criminal conviction rest upon a jury determination that the defendant is guilty beyond a reasonable doubt of every element of the charged crime. (United States v. Gaudin (1995) 515 U.S. 506, 509-510, 115 S.Ct. 2310, 132 L.Ed.2d 444.)
Section 32 provides that an accessory to a felony is one who harbors, conceals, or aids a principal to a felony when the defendant knows that a felony has been committed and intends by his actions to enable a principal to the felony to avoid or escape arrest.[3] CALJIC No. 6.40 correctly instructs a jury that the elements of a violation of section 32 include that a felony occurred and requires that the felony be identified.
Clearly, the commission of a felony is an element of a violation of section 32. Therefore, the Fifth and Sixth Amendments require that before a defendant may be convicted, the jury must find beyond a reasonable doubt that a felony occurred. In the absence of a stipulation, this requirement necessitates instructing the jury with the elements of the underlying felony. Without such instruction, a jury will not be equipped with the necessary information to find that a felony occurred. It will not know the facts the prosecution must prove to establish the underlying felony, i.e., the jury will be left to guess or speculate whether a felony occurred.
A trial court has a sua sponte duty to instruct on the principles of law that are relevant to and govern the case, including instruction on all of the elements of the offense. (People v. Cummings (1993) 4 Cal.4th 1233, 1311, 18 Cal.Rptr.2d 796, 850 P.2d 1.) Since the commission of the underlying felony is an element of the crime, we disagree with the holding in Shields that the trial court does not have a duty to instruct on the elements of that crime. The prosecution was obligated to prove every element of the crime, even if the defense did not challenge one element. (Estelle v. McGuire (1991) 502 U.S. 62, 69-70, 112 S.Ct. 475, 116 L.Ed.2d 385.) Even in the absence of a request, in a section 32 prosecution, the jury must be instructed on the elements of the underlying offense unless the defendant stipulates to the occurrence of the underlying felony. The failure to do so in this case was error.
*838 Magee urges us to adopt a rule requiring reversal without an analysis of whether the error was prejudicial. The United States Supreme Court has classified constitutional errors into two groups; structural errors, which are subject to automatic reversal, and trial errors, subject to a harmless error analysis. (See, e.g., Neder v. United States (1999) 527 U.S. 1, 119 S.Ct. 1827, 144 L.Ed.2d 35, and Arizona v. Fulminante (1991) 499 U.S. 279, 111 S.Ct. 1246, 113 L.Ed.2d 302, opn. of Rehnquist, C. J., for the court as to Part II.)
Structural errors comprise a very limited class of cases and occur where there is a defect affecting the framework within which the trial proceeds rather than simply an error in the trial process itself. (Neder v. United States, supra, 527 U.S. at pp. 8-9, 119 S.Ct. 1827.) Structural errors have been found where there was a complete denial of counsel (Gideon v. Wainwright (1963) 372 U.S. 335, 83 S.Ct. 792, 9 L.Ed.2d 799), where the trial judge was biased (Tumey v. Ohio (1927) 273 U.S. 510, 47 S.Ct. 437, 71 L.Ed. 749), where there was racial discrimination in the selection of the grand jury (Vasquez v. Hillery (1986) 474 U.S. 254, 106 S.Ct. 617, 88 L.Ed.2d 598), where there was a denial of self-representation (McKaskle v. Wiggins (1984) 465 U.S. 168, 104 S.Ct. 944, 79 L.Ed.2d 122), where there was a denial of a public trial (Waller v. Georgia (1984) 467 U.S. 39, 104 S.Ct. 2210, 81 L.Ed.2d 31), and where the reasonable doubt instruction was defective (Sullivan v. Louisiana (1993) 508 U.S. 275, 113 S.Ct. 2078,124 L.Ed.2d 182).
Most constitutional errors are subject to harmless error analysis because they do not necessarily render a criminal trial fundamentally unfair or an unreliable vehicle for determining guilt or innocence. (Neder v. United States, supra, 527 U.S. at pp. 8-9, 119 S.Ct. 1827.) Harmless error analysis has been utilized by the Supreme Court where improper instructions have been given on an element of an offense (Yates v. Evatt (1991) 500 U.S. 391, 111 S.Ct. 1884, 114 L.Ed.2d 432 [mandatory rebuttable presumption], overruled on other grounds in Estelle v. McGuire, supra, 502 U.S. at p. 72, fn. 4, 112 S.Ct. 475; Carella v. California (1989) 491 U.S. 263, 109 S.Ct. 2419, 105 L.Ed.2d 218 [mandatory conclusive presumption]; Pope v. Illinois (1987) 481 U.S. 497, 107 S.Ct. 1918, 95 L.Ed.2d 439 [misstatement of element]; Rose v. Clark (1986) 478 U.S. 570, 106 S.Ct. 3101, 92 L.Ed.2d 460 [mandatory rebuttable presumption], overruled on other grounds in Brecht v. Abrahamson (1993) 507 U.S. 619, 637, 113 S.Ct. 1710, 123 L.Ed.2d 353) and where elements of an offense have been omitted. (Johnson v. United States (1997) 520 U.S. 461, 117 S.Ct. 1544, 137 L.Ed.2d 718; California v. Roy (1996) 519 U.S. 2, 117 S.Ct. 337, 136 L.Ed.2d 266.) Neder involved a failure to instruct the jury on an element of the offense, specifically the requirement that a misstatement on a tax form in a tax fraud case must be material. The Supreme Court concluded that the error was subject to harmless error analysis. (Neder v. United States, supra, 527 U.S. at pp. 7-8, 119 S.Ct. 1827.)
This authority compels our conclusion that the error in this case, failure to instruct the jury on an element of the offense, is subject to harmless error analysis under Chapman v. California, supra, 386 U.S. 18, 87 S.Ct. 824, 17 L.Ed.2d 705, i.e., whether it appears beyond a reasonable doubt that the error complained of did not contribute to the verdict. (Neder v. United States, supra, 527 U.S. at p. 15, 119 S.Ct. 1827.)
Magee acknowledges that failure to instruct on only one element of an offense is subject to harmless error analysis but contends that, because automatic reversal *839 would be required if the trial court failed to instruct on every element of an offense (Arizona v. Fulminante, supra, 499 U.S. at p. 294, 111 S.Ct. 1246), automatic reversal is required where the trial court failed to instruct on most of the elements of the offense. Magee asserts that since there are five elements to a robbery, the trial court failed to instruct on five of the seven elements of the charged crime of being an accessory to a robbery.
To support his theory, Magee cites People v. Cummings, supra, 4 Cal.4th 1233, 18 Cal.Rptr.2d 796, 850 P.2d 1. Cummings and codefendant Gay were convicted of killing a police officer and sentenced to death. The shooting was motivated by the defendants' desire to avoid capture for a series of robberies. Gay also was convicted of 11 counts of robbery, one count of attempted robbery, and one count of conspiracy to commit robbery. Despite these 13 counts related to robbery, the trial judge failed to instruct the jury on the necessary elements of a robbery. As a result of this failure, the Supreme Court reversed the conviction on each count of robbery, concluding that United States Supreme Court precedent required the result. (Id. at p. 1315, 18 Cal.Rptr.2d 796, 850 P.2d 1.)
If Magee were convicted of robbery, Cummings would require reversal. However, Magee was convicted of being an accessory to the robbery. We are required to consider what effect the constitutional error had upon the guilty verdict in the case at hand. (Sullivan v. Louisiana, supra, 508 U.S. at p. 279, 113 S.Ct. 2078.) We reject the assertion that a mathematical computation should be used to determine when reversal is required.
In the above quoted portion of Shields, the court of appeal used reasoning very similar to a harmless error analysis. In our view, Shields reached the correct result because, like here, the underlying felony was not in dispute and the error was harmless.
Here, the testimony establishing a robbery was uncontradicted.[4] Christopher A. hit the victim, knocking him off his bike, and took from his person a cellular phone. Magee acknowledged the robbery was committed, but argued that he did not know that a robbery had occurred and thus could not be convicted as an accessory to the crime. Consistent with this strategy, Magee agreed that the trial court did not need to instruct the jury on the elements of a robbery.
Since no one disputed that the robbery occurred, and the only issue was Magee's knowledge of the perpetrator's actions, we conclude beyond a reasonable doubt that the error did not contribute to the verdict. (Chapman v. California, supra, 386 U.S. at p. 24, 87 S.Ct. 824.) Accordingly, we affirm the judgment.

DISPOSITION
The judgment is affirmed.
WE CONCUR: WISEMAN, Acting P.J, and LEVY, J.
NOTES
[*]   Kennard, J., dissented.
[1]  All statutory references are to the Penal Code unless otherwise stated.
[2]  The instruction as read to the jury stated: "The defendant is accused in Count I of having committed the crime of being an accessory to a felony in violation of Section 32 of the Penal Code. [¶] Every person who, after a felony has been committed, harbors, conceals or aids a principal in that felony, with the specific intent that the principal may avoid or escape from the arrest, trial, conviction or punishment, having knowledge that the principal has committed that felony or has been charged with that felony or convicted thereof, is guilty of the crime of accessory to a felony in violation of Penal Code Section 32.[¶] In order to prove this crime, each of the following elements must be proved: Number one, a felony, namely, robbery, was committed; number two, defendant harbored, concealed or aided a principal in that felony with the specific intent that the principal avoid or escape arrest, trial, conviction or punishment; and number three, defendant did so with knowledge that the principal committed the felony."
[3]  Section 32 states in full: "Every person who, after a felony has been committed, harbors, conceals or aids a principal in such felony, with the intent that said principal may avoid or escape from arrest, trial, conviction or punishment, having knowledge that said principal has committed such felony or has been charged with such felony or convicted thereof, is an accessory to such felony."
[4]  The elements of a robbery are (1) the victim had possession of property of some value, (2) the property was taken from the victim or his or her personal presence, (3) the property was taken against the will of the victim, (4) the taking was by either force or fear, and (5) the property was taken with the specific intent to permanently deprive the victim of the property. (CALJIC No. 9.40.)
