*478INTRODUCTION
The Department of Children and Family Services (Department) filed a dependency petition on G.B.'s behalf, alleging the child had been sexually abused by her mother's boyfriend, and that her mother, Vanessa W. (mother), had failed to protect her from the boyfriend's abuse. Charles B., G.B.'s father (father), was not named as an offending parent in the petition. After finding the allegations of sexual abuse and failure to protect untrue, the juvenile court, on its own motion, added three allegations against father for emotional abuse of the child because it believed father had coached G.B. to lie about mother's and the boyfriend's conduct. Those new allegations, however, were based on facts and a legal theory not at issue in the original petition. Father objected to the court amending the petition on its own motion, and the Department and G.B. opposed the court establishing dependency jurisdiction based on father's conduct. The court later sustained one of the allegations against father, declared G.B. a dependent of the court, and terminated dependency jurisdiction with a family law exit order granting mother sole physical custody of the child.
Father and G.B. appeal from the court's disposition orders.1 We conclude the court erred in establishing jurisdiction based on a factual and legal theory not raised in the original petition. We therefore reverse the disposition orders and the jurisdiction finding as to father, vacate all orders issued after the disposition hearing, and remand the matter for further proceedings in the juvenile court.
*479FACTUAL AND PROCEDURAL BACKGROUND
1. The Family's Background and Prior Referrals
In 2014, mother, father, and G.B. (then five years old) were involved in a family court proceeding. The court in that case issued a custody order awarding mother and father joint legal and physical custody of G.B., with father having custody of the child during alternating weekends and certain holidays, and mother having custody of the child all other times.
Around the time of that family court proceeding, the Department investigated mother on three occasions after receiving referrals that she had physically and sexually *172abused G.B. Each of those referrals was deemed inconclusive or unfounded.
The first investigation occurred in February 2014, after G.B. told father that mother had "tickled" G.B.'s private parts and kissed G.B. using her tongue. The Department deemed the referral inconclusive after G.B. admitted she made up the allegation that mother had touched her inappropriately.
The Department investigated mother again in April 2014, after G.B. returned from mother's custody with a black eye. G.B. initially told father's girlfriend that she had been hit in the eye with a toy car at school, but she later said that mother had struck her face. When interviewed by one of the Department's social workers, G.B. admitted she had lied about mother striking her face. G.B. claimed she made up the lie because father's girlfriend did not believe her original explanation. The Department deemed the referral inconclusive based on G.B.'s admission that she had lied about mother striking her face.
The Department investigated mother a third time in January 2015, after G.B.'s 12-year-old male cousin reported that G.B. had kissed him on the lips. G.B. told father's girlfriend that she had learned her behavior from mother, who allowed her to watch pornographic movies. The Department deemed the referral unfounded after G.B. told a social worker she is only allowed to watch the Disney Channel and Nickelodeon at her mother's house, and that mother's television has a lock on it that prevents G.B. from watching other channels.
2. Initiation of the Underlying Proceedings
On August 1, 2016, the Department received a referral that mother's boyfriend had sexually abused G.B. The child reported that sometime in June 2016, she was playing in mother's living room with the boyfriend. The *480boyfriend put G.B. on his lap, rubbed his "private part" against G.B.'s body, touched her "private part" with his hand over her clothing, and exposed his penis to the child. G.B. described a second incident when she stayed at a hotel near Disneyland with mother, the boyfriend, the boyfriend's ex-wife, and the boyfriend's son. After the boyfriend got out of the shower, he walked into the same room as G.B. with his penis exposed through his towel. G.B. told the boyfriend that she could see his penis, to which he responded "oh" and walked away.
After reporting the alleged sexual abuse, G.B. started seeing a therapist. During one interview, G.B. told the therapist the alleged sexual abuse by mother's boyfriend " 'did not happen.' "
On September 21, 2016, the Department filed a dependency petition on G.B.'s behalf, alleging mother's boyfriend had sexually abused G.B. on two occasions and that mother was aware of, and failed to protect G.B. from, the boyfriend's abuse. ( Welf. & Inst. Code 2, § 300, subds. (b)(1) & (d).) The Department named father as one of G.B.'s parents in the petition, but it did not allege he had engaged in any wrongful conduct with respect to the child.
At the September 21, 2016 detention hearing, the court found father was G.B.'s presumed parent, ordered G.B. detained from mother's custody, and awarded mother visits with the child three days a week. The court expressed concern, however, that the allegations in the petition were untrue, citing the family's "one-sided" history of making unsubstantiated allegations against mother.
*1733. The Original Jurisdiction Hearing
On November 29, 2016, the court held a pre-trial conference hearing. The court stated it had read the Department's jurisdiction and disposition report and watched a video-recorded interview of G.B. conducted by the child's therapist. The court noted that during the interview, G.B. appeared "very happy," "bouncy," and "practically giddy," and she admitted to the therapist that mother's boyfriend never sexually abused her. The court warned that if it concluded the allegations against mother and her boyfriend were false, it would "amend[ ] the petition to have the father be offending for calling in false allegations" and issue a custody order giving "sole legal, sole physical [custody] to the mother, with monitored visitation for the father."
On December 12, 2016, the court commenced the jurisdiction hearing. Mother, G.B., and father testified, and the court admitted into evidence the *481video-recording of G.B.'s interview with her therapist, the transcript of that interview, the Department's reports, and a photograph of mother's boyfriend.
The court issued its findings and orders without hearing argument from the parties.3 After the evidentiary portion of the hearing ended, the court found that "[t]he Department has clearly not met its burden with respect to mother." The court explained that father was not credible and that G.B. could not be "truth-qualified" because she "ha[d] been so abused by father." After reiterating that the evidence "does not support an allegation against the mother," the court released G.B. to mother with father to have monitored visitation.
Although the court did not sustain the sexual abuse and failure to protect allegations, the only allegations asserted in the petition, it did not dismiss the petition. Instead, the court stated it intended to sustain jurisdiction allegations against father under section 300, subdivisions (a), (b), and (c), because it believed father had coached G.B. to fabricate the accusations against mother and her boyfriend.4 None of the parties asked the court to assert allegations against father, and neither the Department nor the court filed a new or amended petition naming father as an offending parent. Father's counsel objected to the court asserting allegations against father. After determining it had not given father sufficient notice to allow him to contest the newly-crafted allegations against him, the court continued the jurisdiction hearing to January 9, 2017.
4. Adjudication of the Allegations Against Father
On January 9, 2017, the court commenced a jurisdiction hearing to address *174the allegations it had asserted against father. Father's counsel objected to the court adding allegations against father on its own motion, arguing the court's procedure violated father's due process rights: "[W]ith the court being the fact-finder, as well as the moving party in terms of these new allegations, I *482believe I am at a significant disadvantage to the point where my client's due process rights are infringed upon. [¶] I don't believe we could fairly proceed when we're going against the court; the very party, or the very-I don't want to call the court a party, but it feels like I'm going against the court as a party in this case."
The court rejected counsel's argument, explaining it was acting not as a party to the case but rather pursuant to its "authority to amend according to proof and to find a non-offending parent offending." The court went on: "I'm considering amending because of my concern that the father abused the process of the court and that the father abused his child. ... [¶] I am faced with a situation where if I dismiss this action, there would have been no way to protect the child. And I think that it's appropriate under the circumstances." The court continued the jurisdiction hearing so that it could review the file from the family's prior family law case.
When the jurisdiction hearing reconvened on February 14, 2017, father's counsel again raised a due process objection to the court's decision to amend the petition on its own motion. The court noted father's objection and stated its actions were authorized because it was acting in G.B.'s best interests.
After the court admitted into evidence one of the Department's last minute reports, it asked the Department's counsel if she wanted to add "anything further." The Department's counsel replied she would "reserve rebuttal" because "[i]t [didn't] seem appropriate for [her] to begin." The court then noted the Department did not "really agree" with the court's decision to adjudicate allegations against father. Later during the hearing, the Department and G.B.'s counsel argued the court should dismiss the allegations against father because there was insufficient evidence to sustain a finding that G.B. faced a risk of suffering serious psychological or emotional harm as a result of any coaching by father. The court continued the jurisdiction hearing to allow the parties to submit additional briefing on the allegations against father.
On March 7, 2017, the court resumed the jurisdiction hearing. The court issued its rulings and findings through a written order. The court first concluded it was authorized to amend the dependency petition on its own motion to include allegations against father, even though he was a non-offending parent under the original petition. The court noted that section 300.2, the purpose provision of the dependency statutory scheme,5 and the provisions of the Code of Civil Procedure incorporated by the Welfare and Institutions *483Code, which permit amendments of pleadings to conform to proof so long as the amendments do not mislead a party to its prejudice,6 authorized it to "make a non-offending *175parent offending." The court also concluded father had not been misled or prejudiced by the amendments to the petition because it provided him adequate notice of, and the opportunity to argue against, the new allegations.
The court then adjudicated its jurisdiction allegations. The court dismissed the allegations under section 300, subdivisions (a) and (b), concluding there was no evidence that father's conduct had placed G.B. at a risk of serious psychological or physical harm. The court sustained the allegation under section 300, subdivision (c), however, finding father had a history of coaching G.B. to make false accusations against mother and that father's conduct had caused G.B. to suffer serious emotional harm. Specifically, the court found G.B. struggled with anxiety, could no longer " 'distinguish reality from fiction,' " and displayed signs of emotional trauma by acting "giddy" while describing the alleged assault by mother's boyfriend during her forensic interview.
5. Disposition and Termination of Dependency Jurisdiction
On May 8, 2017, the court held a disposition hearing. The court declared G.B. a dependent of the court, ordered her placed in mother's custody, and awarded father unmonitored visits with the child on the weekends.
On November 15, 2017, the court terminated dependency jurisdiction and issued a family law exit order.7 The court granted mother and father joint legal custody of G.B., with mother receiving sole physical custody of the child. The court awarded father unmonitored visits with G.B. every Friday evening to Saturday morning, with any additional visitation to be negotiated by the parents.
Father and G.B. timely appealed from the court's disposition orders.
*484DISCUSSION
Father8 contends the court erred when, after dismissing all the allegations in the dependency petition, it crafted, added, and adjudicated jurisdiction allegations against him based on a factual and legal basis not at issue in the original petition. We agree.
1. The court should have dismissed the petition once it found all the allegations were unsubstantiated.
We begin by addressing whether the court could, on its own motion, assert jurisdiction allegations against father based on a factual and legal theory not at issue in the dependency petition after it found the original allegations were unsubstantiated. Because this issue involves statutory interpretation, our review is de novo. ( In re Nicholas E. (2015) 236 Cal.App.4th 458, 462, 186 Cal.Rptr.3d 656.)
"The litigation of dependency cases follows the statutory blueprint penned by our Legislature." ( In re Nicholas E. , supra , 236 Cal.App.4th at p. 463, 186 Cal.Rptr.3d 656.) Dependency proceedings begin with the filing of a verified petition as described in section 332. If the petition is not verified, it is subject to dismissal without *176prejudice. (§ 333.) The discretion to file a section 300 petition alleging that a child comes within the juvenile court's dependency jurisdiction belongs to the social worker, not the court. (See § 325; Cal. Rules of Court, rule 5.520(a).) " ' " ' "[A] juvenile court is vested with jurisdiction to make only those limited determinations authorized by the legislative grant of those special powers." ' " ' " ( In re David B. (2017) 12 Cal.App.5th 633, 645, 219 Cal.Rptr.3d 108.)
The procedure the juvenile court must follow when adjudicating a dependency petition at a contested jurisdiction hearing is set forth in sections 356 and 358, as well as rule 5.684 of the California Rules of Court. (See In re Lauren P. (1996) 44 Cal.App.4th 763, 769, 52 Cal.Rptr.2d 170.) These provisions provide for two possible outcomes when the court adjudicates a dependency petition. If the court finds the social services agency has proved by a preponderance of the evidence some or all of the allegations of the petition, it must proceed to a disposition hearing. (§§ 356, 358, subd. (a); Cal. Rules of Court, rule 5.684(e).) But if, as in this case, the court finds the social services agency has not proved by a preponderance of the evidence any of the petition's allegations, the court usually must dismiss the petition, terminate any detention orders relating to the petition, and order the child returned to *485the custody of his or her parents. (§ 356; Cal. Rules of Court, rule 5.684(g) ["If the court determines that the allegations of the petition have not been proved by a preponderance of the evidence, the court must dismiss the petition[,] terminate any detention orders relating to the petition[,] ... [and] order that the child be returned to the physical custody of the parent or guardian...."].9 )
At the December 12, 2016 contested jurisdiction hearing, the court found the Department failed to prove by a preponderance of the evidence the truth of all the allegations asserted in the petition, allegations involving sexual abuse and mother's failure to protect the child from that abuse under subdivisions (d) and (b) of section 300. When the court made its findings, those were the only allegations in the petition. The Department had not alleged father was an offending parent or that his conduct in any way brought G.B. within the court's jurisdiction, and none of the parties had sought to amend the petition to include allegations against father. Because the court found that all the allegations in the petition were not true, the court should have dismissed the petition, terminated its detention orders, and returned G.B. to the custody of her parents *177under the terms of the 2014 family court custody order that was in place at the time the child's dependency proceedings were initiated. (§ 356; Cal. Rules of Court, rule 5.684(g).)
In reaching this conclusion, we do not mean to suggest that a juvenile court may not amend a petition when the social services agency has not proved the exact allegations of the petition. Certainly, the court may amend the petition "to correct or make more specific" the factual allegations that support the basis for establishing jurisdiction "when the very nature of the charge remains unchanged." ( In re Man J. (1983) 149 Cal.App.3d 475, 481, 197 Cal.Rptr. 20.) Indeed, such amendments are favored in the dependency *486context, in light of the "haste with which petitions are sometimes drafted, and section 332's statement that only a 'concise statement of facts is required'...." ( In re Jessica C. (2001) 93 Cal.App.4th 1027, 1041-1042, 113 Cal.Rptr.2d 597, fn. omitted ( Jessica C. ).) But "[i]f a variance between pleading and proof ... is so wide that it would, in effect, violate due process to allow the amendment, the court should, of course, refuse any such amendment." ( Id. at pp. 1041-1042, 113 Cal.Rptr.2d 597.)
Jessica C. illustrates the type of amendment that is appropriate in the dependency context. In Jessica C. , the social services agency filed a petition alleging the minor's father had "penetrated his daughter's vagina with his penis," but the child later testified that her father had only "touched her vagina with his penis...." ( Jessica C. , supra , 93 Cal.App.4th at p. 1040, 113 Cal.Rptr.2d 597.) The juvenile court denied the agency's request to amend the petition by substituting "touching" for "penetrating." ( Ibid . ) The reviewing court reversed the juvenile court's denial of the agency's request to amend the petition, holding the proposed amendment would not have prejudiced the father since it involved conduct and legal theories nearly identical to the original allegations. ( Id . at p. 1042, 113 Cal.Rptr.2d 597.) Specifically, the court reasoned: "Here, it cannot be seriously maintained that [father] would possibly have prepared his defense differently if the allegation had been that he had 'touched' his daughter's vagina with his penis, as distinct from 'penetrated.' The basic allegation was there, and any variance between 'touching' and 'penetrating' could not have misled him to his detriment. Both allegations are heinous, and entail the intimate violation of a child." ( Ibid . )
The court in this case, however, exceeded its authority to amend the petition to conform to proof. Unlike in Jessica C. , the court's amendments did not incorporate the same "basic allegation" at issue in the original petition. Rather, the court's newly-added allegations completely changed the grounds for establishing jurisdiction over G.B. Specifically, the court's allegations sought to establish jurisdiction over G.B. under a different legal theory than the original allegations (emotional abuse versus sexual abuse); they named father as an offending parent even though he was non-offending in the original petition; and they were based on a set of facts not at issue in the original allegations (father's alleged coaching of G.B. to fabricate allegations against mother and her boyfriend versus the boyfriend's alleged sexual abuse and mother's failure to protect G.B. against that abuse).
In sum, the court had no statutory authority to amend the petition to assert allegations against father based on a factual and legal theory not at issue in the original petition. Because no party had proposed any amendments to the petition before the court found the original allegations were unsubstantiated, the court should have dismissed the petition, terminated *178its detention orders, and returned G.B. to her parents' custody. *4872. The court violated father's due process right to a fair trial when it crafted, asserted, and adjudicated jurisdiction allegations against father.
The court's actions in this case were improper for another reason. By crafting, asserting, and adjudicating new allegations against a non-offending parent based on a factual and legal theory not at issue in the original petition, the court assumed two roles: advocate and trier of fact. In doing so, the court deprived father of his due process right to a fair trial before a disinterested neutral.
A parent has a fundamental right to the " 'care, custody and management of his or her children ... [,]' " which is protected by the due process clause of the United States Constitution. ( In re Kristin H. (1996) 46 Cal.App.4th 1635, 1661-1662, 54 Cal.Rptr.2d 722 ; see also Lois R. v. Superior Court (1971) 19 Cal.App.3d 895, 901, 97 Cal.Rptr. 158 ( Lois R. ) ["The parental right to have children and to the custody of those children is included among the liberties protected by the due process clause."].) And in contested dependency proceedings, due process "require[s] that 'not only must there be actual fairness in the hearing but there must be the appearance of justice.' [Citations.]" ( In re Jesse G. (2005) 128 Cal.App.4th 724, 729, 27 Cal.Rptr.3d 331 ( Jesse G. ).) In such cases, " 'the parents are entitled to a fair hearing with an impartial arbiter, both in fact and in reality, and that means the provision of a referee who does not assume the functions of [an] advocate.' " ( In re Emily D. (2015) 234 Cal.App.4th 438, 445, 183 Cal.Rptr.3d 830 ( Emily D. ).)
In a contested dependency proceeding, such as this one, the social services agency assumes a role akin to the prosecutor in a criminal or a juvenile delinquency proceeding. (See In re Ashley M. (2003) 114 Cal.App.4th 1, 7, fn. 3, 7 Cal.Rptr.3d 237 ; see also Scott v. County of Los Angeles (1994) 27 Cal.App.4th 125, 135, 32 Cal.Rptr.2d 643 [a child-welfare agency is delegated "quasi-prosecutorial functions in connection with proceedings under Welfare and Institutions Code section 300"].) In that role, the social services agency generally is responsible for initiating dependency proceedings on a minor's behalf. ( Ashley M. , at p. 7, fn. 3, 7 Cal.Rptr.3d 237 ; see also § 325; Cal. Rules of Court, rule 5.520(a).) The social services agency also carries the burden of proof on most issues in the proceedings, including whether the child falls within the court's jurisdiction and, if so, whether the child should be removed from his or her parents' custody. ( Ashley M. , at p. 7, fn. 3, 7 Cal.Rptr.3d 237.)
The juvenile court, on the other hand, serves as an impartial trier of fact. (See Emily D. , supra , 234 Cal.App.4th at pp. 445-446, 183 Cal.Rptr.3d 830.) Specifically, the court is tasked with determining whether the allegations in the dependency petition are true. ( Id . at p. 446, 183 Cal.Rptr.3d 830 ; see also Cal. Rules of Court, rule 5.684(a) ["If the *488parent or guardian denies the allegations of the petition, the court must hold a contested hearing and determine whether the allegations in the petition are true."].) While the court may perform some functions typically associated with those performed by an advocating party, such as calling and questioning witnesses (see Cal. Rules of Court, rule 5.684(b) ; Evid. Code, § 775 ), the court's authority to direct the initiation of dependency proceedings or the filing of allegations against a parent is limited. *179For example, under section 331,10 the court may be called upon to review the social services agency's decision not to initiate dependency proceedings after the agency has received an application from a third party requesting the agency to initiate such proceedings. If the court concludes the agency erred in refusing to initiate dependency proceedings, it may order the agency to commence them. (§ 331.) In exercising its authority under section 331, however, the court acts in a traditional judicial role, adjudicating an actual controversy between adversarial parties to determine whether the agency erred in refusing to initiate dependency proceedings. (See In re M.C. (2011) 199 Cal.App.4th 784, 813-814, 131 Cal.Rptr.3d 194 [when the court orders a social services agency to initiate a dependency proceeding under § 331, it is doing so pursuant to its authority to adjudicate actual controversies between multiple parties].)
But a juvenile court lacks the authority to, on its own motion, initiate dependency proceedings against a parent. (See Cal. Rules of Court, rule 5.520(a) ["Except as provided in sections 331, 364, 604, 653.5, 654, and 655, the social worker or probation officer has the sole discretion to file a petition under section 300 and 601."].) The reason for this is obvious: when a court asserts its own allegations, based on facts and legal theories not at issue in the original petition, and later adjudicates those allegations, it assumes the roles of both an advocate and the trier of fact, thereby depriving parents of their right to a fair and impartial arbiter. (See Jesse G. , supra , 128 Cal.App.4th at p. 730, 27 Cal.Rptr.3d 331 [a parent's right to due process is violated when the court assumes the dual obligations of an advocate and a trier of fact].) This is especially true when the social services agency opposes the court's proposed allegations, like the Department did in this case. Under those circumstances, the court has, in essence, displaced the social services agency and eliminated any distinction between the roles of advocate and impartial arbiter.
*489The court in Lois R. aptly described the serious concern that arises when a juvenile court acts as both advocate and trier of fact: "It is not difficult to imagine the distress felt by a parent who finds the hoped for impartial arbiter virtually presenting the case for depriving him of custody. Statements in statutes and case law to the effect that the court is to serve as a benevolent parental figure interested only in the welfare of the child, even if known, would be of small comfort." ( Lois R. , supra , 19 Cal.App.3d at p. 902, 97 Cal.Rptr. 158.)
With these principles in mind, we conclude the court violated father's due process right to a fair trial when it crafted, asserted, and then adjudicated allegations against him based on a factual and legal theory not raised in the original dependency petition and opposed by the Department. That the court gave father notice and an opportunity to contest the allegations, or that the court was motivated by a desire to protect the child, are, as noted in Lois R. , small comfort to father. Because the court improperly assumed the dual role of advocate and trier of fact, the court's disposition orders and jurisdiction findings as to father must be reversed for *180this additional reason. (See Jesse G. , supra , 128 Cal.App.4th at p. 731, 27 Cal.Rptr.3d 331 [when the juvenile court improperly assumes the role of an advocate and the trier of fact at the adjudication hearing, the error is reversible per se].)
DISPOSITION
The juvenile court's jurisdiction finding as to father and its disposition orders are reversed. All orders issued after the disposition hearing are vacated. The matter is remanded for further proceedings consistent with this opinion.
WE CONCUR:
EDMON, P. J.
DHANIDINA, J.
The Department has not participated in this appeal.
Although the court made oral findings at the December 12, 2016 hearing, it issued a written ruling the next day (December 13), which the court stated was "intended to be controlling" over any inconsistent oral findings made at the December 12 hearing.
In its written ruling issued on December 13, 2016, the court stated it was considering sustaining the following allegations against father:
"As to Sections 300(a) and (b), 'Minor has suffered and is at substantial risk of further suffering serious psychological harm as a direct result of her Father coercing her to make false allegations as part of a long running Family Law and custody dispute and her Father is both unable to provide for the psychological well-being of Minor and intentionally causing her well-being to suffer, leading to a substantial risk of future substantial serious psychological harm.'
"As to Section 300(c), 'Minor has suffered both serious emotional damage and has a risk of future serious emotional damage, caused by Father's coercing Minor to make false allegations against Mother and Boyfriend.' "
Section 300.2 provides in relevant part: "[T]he purpose of the provisions of ... relating to dependent children is to provide maximum safety and protection for children who are currently being physically, sexually, or emotionally abused, being neglected, or being exploited, and to ensure the safety, protection, and physical and emotional well-being of children who are at risk of that harm."
Section 348 provides in relevant part: "The provisions of Chapter 8 (commencing with Section 469 ) of Title 6 of Part 2 of the Code of Civil Procedure relating to variance and amendment of pleadings in civil actions shall apply to petitions and proceedings under this chapter, to the same extent and with the same effect as if proceedings under this chapter were civil actions."
We granted father's request for judicial notice of the juvenile court's November 15, 2017 minute order as well as the court's custody and visitation orders issued that same date.
In her opening brief, G.B. joins in all of father's arguments. For brevity's sake, we use father's name only when referring to the parties on appeal who challenge the court's jurisdiction findings and disposition orders.
If the social services agency requests dismissal of the petition over the minor's objection, the juvenile court may not dismiss the petition unless it first determines that " 'dismissal is in the interests of justice and the welfare of the minor.' " (See In re E.A. (2018) 24 Cal.App.5th 648, 664-665, 234 Cal.Rptr.3d 346, quoting Allen M. v. Superior Court (1992) 6 Cal.App.4th 1069, 1071, 8 Cal.Rptr.2d 259.) In making this determination, the court may consider the "totality of the [family's] circumstances," including evidence that may support exercising jurisdiction over the minor under a subdivision of section 300 not alleged in the original petition. (See E.A. , at p. 665, 234 Cal.Rptr.3d 346 ; see also id . at p. 665, fn. 10, 234 Cal.Rptr.3d 346 [discussing section 348 and the provisions of the Code of Civil Procedure on variance and amendment of pleadings in explaining why a minor is allowed to present evidence relevant to subdivisions of section 300 not pled in the original petition when challenging an agency's request to dismiss the petition].)
This rule does not apply in this case because G.B. never opposed dismissing the petition after the court found the original allegations were unsubstantiated. Instead, as we discussed in our factual summary, G.B.'s counsel expressly opposed establishing dependency jurisdiction based on conduct not alleged in the petition-i.e., father's conduct.
Section 331 provides: "When any person has applied to the social worker, pursuant to Section 329, to commence juvenile court proceedings and the social worker fails to file a petition within three weeks after the application, the person may, within one month after making the application, apply to the juvenile court to review the decision of the social worker, and the court may either affirm the decision of the social worker or order him or her to commence juvenile court proceedings."