What is Alan supposed to answer if his hat is Blue? He can't "tell the truth" and answer Yellow or Green.

I worked from the idea that the man's answer would have to be Yes or No - was his hat either of the two colors. However, I can't find a solution that works in all cases. The closest I come is asking each man about the three colors he isn't wearing, duplicating one between them. For example:

Alan, is your hat blue or yellow?

Alan, is your hat blue or green?

If he answers Yes to both questions or No to both questions, I know his hat isn't blue. If he answers Yes to one and No to the other, his hat is blue - regardless of which was a lie and which was the truth.

Using that methodology, I can work out the man to hat color in all scenarios but one -- where every man answers the same thing to both questions.

Either I'm missing a trick (a variation on the question that fits within the rules given -- "the question must be about the color of their own hat" and "must be about two hats, not just one") or there isn't a solution that works 100% of the time. For mine, sometimes I can solve by the second question to the second man -- and other times I get to the last man only to have two colors and two men that are not solved.