As attorney general, she disappointed California liberals through both actions and the lack of action. That did not hamper her ability to burnish her national credentials. She addressed the 2012 Democratic National Convention in a prime-time slot. Her name was floated as a potential United States attorney general, even a Supreme Court justice.

Yet she remained largely unknown in California — a function of the staggering size of a state of almost 40 million where the principal way to gain exposure requires television ads in a dozen media markets, at a cost of upward of $4.5 million a week. When Ms. Harris ran for the United States Senate in 2016 , six out of 10 registered voters had no impression of her, although she had been attorney general for almost six years. In recent polls, about a quarter of voters still had no opinion.

That reality undercut a key argument cited by pundits who labeled her an instant front-runner when she entered the presidential race. Their scenarios assumed she would do well in the delegate-rich California primary, moved up to March to have more impact on the race.

With weak party allegiances, Californians are notoriously independent voters, as many politicians have discovered. Jerry Brown won the California Democratic primary in his 1976 presidential campaign but lost the next two times he tried. His father, Gov. Pat Brown, ran as a favorite son and planned to turn the state’s delegates over to John Kennedy at the 1960 convention, only to be humiliated when almost half insisted on casting ballots for Adlai Stevenson.

And then there is the role of California in the age of President Trump. His victory coincided with Ms. Harris’s election to the Senate and fueled a sense of inevitability about her candidacy. She was the prosecutor who could take on the president. From the state that had become the heart of the resistance came the candidacy fueled by anti-Trump anger and California glitter.

At her January kickoff in Oakland, a huge crowd of all ages and races waved flags, pumped fists, teared up. They cheered her passion, her toughness and her rhetoric. But above all they were cheering for a woman who would take on the man whose name she never mentioned.

This, too, was not quite what it seemed. It was easy to conflate antipathy to Mr. Trump with support for Ms. Harris. By the time she appeared in Oakland eight months later at a low-key event to open her campaign office, the questions were about polls that showed her running a distant fourth in her home state, fourth even in the Bay Area, where they knew her best.