That's not true. It is specifically on the books that you can resist unlawful arrest up to and including killing the officer. People have done it and not received penalty for it.
Read the wiki article I linked. You can only resist unlawful arrest by a police office in very very limited circumstances. Simple mistake by the police is not included.
You are probably confusing resisting arrest by someone who is not actually a police officer.