It is surely impossible for any system devised and run by human beings to ever operate "error-free." However, there are at least two things that could be done to reduce errors that are based on race (which is, I assume, what you are asking about in this question).
First, there should be some sort of review to ensure that the sentencing guidelines for various types of crimes are equitable. There should not be the sort of situation that we have where a "black" crime (crack cocaine) is punished more heavily than a similar "white" crime (powder cocaine).
Second, it might be possible to have sentencing done on a blind basis. If a person is convicted, his or her file could be sent to a sentencing commission with all pictures and names and other racially identifiable factors removed. The commission could then base sentences on the actual facts of the case without having to know the race of the criminal or the victim.
Neither of these things would be easy, but they might help to reduce errors.