Thursday’s spectacle is likely to make replacing her that much more difficult.

“How embarrassing!” said George Arzt, a veteran political consultant who was a press secretary to Mayor Edward I. Koch. “In the past there are people who have pulled out of jobs they’ve been appointed to, but I don’t remember any job as prominent as schools chancellor. But it’s certainly shocking, and they have to renew their search and find someone very quickly.”

Mr. Arzt added, “The problem is that the new person will be viewed as the second choice.”

The courtship of Mr. Carvalho went on for more than a month. Mr. Phillips said Mr. Carvalho met with the mayor twice at Gracie Mansion, once in January and once in February. Mr. de Blasio’s wife, Chirlane McCray, who routinely participates in City Hall hiring decisions, was deeply involved in the interview process as well.

Mr. Carvalho told Mr. de Blasio that he would take the job last week, Mr. Phillips said, and it seemed that the matchmaking had ended. But an announcement was postponed at least once when Mr. Carvalho said that he could not leave his district because of gun scares and jitters in the aftermath of the school shooting at Marjory Stoneman Douglas High School, which is in a neighboring district. Mr. Phillips said an announcement was scheduled for Monday and then scratched, and the same for Thursday.

On Wednesday, the news media in New York were told that Mr. Carvalho would be the new chancellor. Mr. de Blasio said that Mr. Carvalho agreed that City Hall could give word of the announcement to the news site Politico. But officials in Miami warned caution, saying that he had not made a public statement yet, so perhaps it was not final.

A measure of panic began to set in at New York’s City Hall on Wednesday night, after the initial news reports and indications that Mr. Carvalho appeared to be getting cold feet, according to someone familiar with the matter. The person spoke on condition of anonymity because they were not authorized to discuss private conversations in City Hall.

Late into the evening, phone calls went back and forth between New York and Miami. At one point, at least one senior administration official spoke by phone with Mr. Carvalho, who reiterated the promise he had made about taking the job, according to the person. Mr. Carvalho did not suggest he was backing out of the job on Wednesday, the person said, but instead offered logistical and other reasons for remaining in Florida that day.

At Thursday’s board meeting in Miami, speaker after speaker lavished praise on Mr. Carvalho for preventing budget cuts to the arts, advocating on behalf of immigrants and stabilizing a school district that before his tenure had been notorious for political upheaval.