I think there are two reasons she didn't do well in the primary debates:
1. She was debating multiple people on stage, and had difficulty finding her place on the left/moderate spectrum. I believe she felt there was room to position herself as a progressive, not quite at the level of Sanders and Warren, but definitely to the left of Biden, Buttiegieg, and Klobuchar. Unfortunately for her, that's difficult to pull off when she already had a reputation as a tough-on-crime DA in San Francisco. Tulsi Gabbard bludgeoned her with her own record of prosecuting drug-dealers at a time when many people were questioning our legal system and the role of police in it.
2. Second, the worst thing that can happen for a candidate during these crowded primary debates is to not make an impression at all. Kamala overcompensated for that by using what I call "tag-line tactics." It seemed every time she spoke, her goal was to provide a tag line that could go viral and set herself apart from the others. It worked briefly when she went at Joe Biden with the "That little girl was me" argument, but failed to resonate when subsequent attempts fell flat. At the end, it appeared as though she didn't know what she stood for, didn't really have any specific policies, and was just trying to create a campaign based on catch phrases. Check out the SNL debate skits with Maya Rudolph as Harris. She is spot on .
The good news is, I don't think I've ever witnessed a politician polish up her game over a four year stretch like Kamala Harris did. She is NOT the same candidate she was four years ago. Maybe some of that is due to the fact she's only being asked to run against a single, flawed individual, and maybe some of that is due to the fact that her previous "weakness" as a law-and-order type has now become a strength. But her transformation has been remarkable. So I do have hope that she can knock Trump around on a debate stage.