It's not normal but does happen from time to time. Speak to an appellate attorney.
The response above is not intended as legal advice since it’s impracticable to provide thorough, accurate advice based upon the query without additional details. It is highly recommended that one should seek advice from a criminal defense attorney licensed in your jurisdiction by setting up a confidential meeting. Moreover, this response does not constitute the creation of an attorney-client relationship since this message is not a confidential communication because it was posted on a public website, thereby publicly disclosing the information, which is another reason to setup a confidential meeting with an attorney.
This does happen. that's what Penal Code Section 995 is for.
No legal advice is given here. My responses to questions on Avvo are never intended as legal advice and must NOT be relied upon as if they were legal advice. I give legal advice ONLY in the course of a formal attorney-client relationship. Exchange of information through Avvo's Questions & Answers forum does not establish an attorney-client relationship with me. That relationship is established only by joint execution of a written agreement for legal services. I am only licensed in the States of California and New York and the District of Columbia
At preliminary hearing, the prosecution can request that the defendant be held to answer (ordered to stand trial) on any charges and enhancements they think they have proven. If the magistrate hearing the preliminary hearing agrees, they bind the defendant over on those charges and enhancements. The judge at prelim may not think there's enough evidence to support additional charges or enhancements and deny the request for a bind-over on those added charges/enhancements. The prosecution can file them in the new charging document (the "Information") anyway. The defense can then challenge whether there was in fact enough evidence through a motion pursuant to Penal Code section 995.
If the enhancement was charged in the Information, it can properly be part of the plea bargain. If it was not filed, it can be added as part of a plea agreement, but the Information must be amended (either formally by filing a new document or by "interlineation" by requesting the court write it in). The defendant must be arraigned on the charges they are pleading guilty to. If the enhancement was not in the original Information, the judge should have arraigned the defendant (informed the defendant that the charge/enhancement was added) prior to taking the plea.
That enhancement may have been added in exchange for dismissal of other charges, etc. Without reviewing the entire file, charging documents and transcript of the plea itself, it's tough to say exactly what happened. What I describe above is the general principle and the procedures involved.
The above answer is for general information only and is based on the information you posted. Every case is fact dependent, so to get a thorough analysis of your situation, you will need to consult face to face with an attorney licensed to practice in the jurisdiction where the incident took place. Do not conclusively rely on any information posted online when deciding what to do about your case.