Flawed characters = better story. Fiction ≠ a how-to-live manual.
I'm sorry, but I wrote a bit of a manifesto. Here goes.
I'm a human who screws up sometimes, and as such, I find it comforting and endearing when characters in books make mistakes too. Characters who are perfect aren't inspiring to me; they're usually boring, in fact. Sure, if all the main characters are so flawed that they're obnoxious and I wouldn't want to hang out with them ever, I might take off one star on my book review for that alone. If they commit truly awful deeds and display unashamed bigoted thinking, AND they never seem to realize it's a problem and aren't any better by the end of the book, then yeah, that's a sucky book right there and it deserves a scathing one-star review.
But your basic subtle human flaws--someone saying the wrong thing or making a dumb choice because they're stressed or emotional--those resonate with me, and those are also *necessary* for a compelling drama. In fiction, a character must go through struggles, and if the struggles are solely external (human or paranormal antagonists, forces of nature, harsh circumstances), that's going to be less interesting than a story that includes internal conflicts too (characters facing and overcoming their own flaws).
In my books, you're going to find protagonists with flaws, who will sometimes do or say things that make you want to yell, "NO, STOP," because they aren't perfect and their insecurities will make them screw up now and then. But they do learn, and by the end they acknowledge their mistakes and apologize for them, and end up better people than when the story started.
So if you're reading fiction with the idea that everyone, from the very start of the story, must be the paragon of whatever identity they are--man, woman, parent, teenager, gay, bi, straight, conservative, liberal, American, Chinese, Argentinian, you name it--and never ever make a mistake or else it reflects badly on their "group," then...I think you and I disagree on the point of fiction.
We all want to be careful with our representation, yes; e.g., if you only have one Asian character and they're a sadistic fiend, that might send a negative message about Asians that you (I hope) didn't intend. We obviously should also avoid flat stereotypes; all main characters should get to be well-rounded. But that's a side topic that others have already covered exhaustively and well. I'm here to defend characters who are well-rounded but flawed, no matter what their other attributes.
A novel isn't a straight-up how-to manual. It isn't a self-help book. It's a *story*. Which can and (maybe?) should have role models, sure, but they're likely going to be the type of role models who mess up and go through difficult and interesting trials and who come out stronger for it. Just like we all can. Just like we all do. Even though it's uncomfortable to admit it.