To be an artist is to be judged, not just for what you do, but for what you are.
Sometimes the judgment is fair. For example, Celine was anti-semitic. I disagree with those who say that's sufficient reason to leave him out of an upcoming commemoration of French writers—to be human is to be flawed, and greatness often co-exists with great flaws— but I agree with Richard Prasquier's observation, "When the text is despicable, so is the writer."
But sometimes the judgment is not fair. Sometimes the failure is the reader's.
An easy example: Twain used racist language to write a profoundly antiracist novel.
A harder example: People who don't understand Christ figures will conclude that Uncle Tom is weak rather than the most admirable character in the novel.
A challenging example: In the 1960s, Asa Carter was unequivocally racist. Whether he truly changed his nature when he became Forrest Carter and wrote The Education of Little Tree is debated. The only black person in the novel does some admirable things, but he's a minor character. However, whatever the strengths and weaknesses of the book may be, it's not the work of a writer who secretly thinks American Indians are inferior to white people.
Because this is true: the work reveals the soul. Writers cannot hide their prejudices. When the only capable characters in a story are white men or brown women, you know the writer has issues. When the characters represent the world as it is or the world as you wish it would be, you know the writer is like you.
I was inspired to write this by a comment about a writer whose work I know. I'm not going to link to the commenter, who can most kindly be described as very naive, or name the writer, who does not need any controversy—but it's not me or Emma, so don't bother googling our names in the hope of finding the comment.
What struck me was the commenter's claim that the writer was racist, but the commenter enjoyed the writer's work, so the commenter bought it second-hand.
I wanted to leave this reply: Either the writer is racist, and you enjoy the work because you are, too, or you've misjudged the writer. I've read stories by that writer, and you're right to enjoy them: they've got complex characters of all hues and beliefs and orientations in them. The work isn't racist. And that means the writer isn't, either. You're making the same mistake that people do who say Matt Taibbi is anti-semitic for writing about corruption at Goldman Sachs: your beliefs are making you see racism where it does not exist.
But I decided to write this instead.