Before a judge accepts a guilty plea, or an admission to sufficient facts, the judge has to question you on the record. That conversation is called the plea colloquy. It's required by Rule 12 of the Massachusetts Rules of Criminal Procedure, and it exists to make sure your plea is knowing and voluntary.
What the judge tells you
You're giving up your right to a trial, with or without a jury.
You're giving up your right to confront the witnesses against you.
You're giving up the presumption of innocence and your privilege against self-incrimination.
The maximum possible sentence, and any mandatory minimum.
If you're not a U.S. citizen, that the plea may lead to deportation, exclusion from admission to the United States, or denial of naturalization.
Other consequences that apply to certain charges, such as sex offender registration.
What the judge asks and decides
The prosecutor states the facts the Commonwealth would prove. The judge asks whether you still want to go forward, and has to find that the plea is knowing and voluntary and that there's an adequate factual basis for it. You don't have to agree with every detail of the prosecutor's version for the judge to accept it.
Your right to withdraw
In District Court, pleas are defendant-capped. If the judge intends to impose a sentence harsher than what you asked for, or harsher than an agreed recommendation, the judge has to say so and give you the chance to withdraw the plea. In Superior Court, pleas are Commonwealth-capped: the trigger is a sentence harsher than the prosecutor's recommendation or an agreed recommendation.
Why it matters
The same process applies whether you plead guilty or admit to sufficient facts for a continuance without a finding. Answer the judge's questions honestly, and if you don't understand something, say so. If the colloquy was defective, for example if a required immigration warning wasn't given, that can be a basis to withdraw the plea later.
If you're thinking about resolving your case with a plea, contact me so we can go through the consequences before you're standing in front of the judge.