On the one hand, usual formulation is you only get one question, finding out which is the liar alone is easy but useless as then you’re out of questions to actually get through the gate. On the other hand, unless you get the information about the behavior of the guards from a trusted source that isn’t them you have no reason to believe them, and in fact they cannot relay the setup to you accurately without giving it away if you assume they’re always like that as many do.
Sadistic DM Take - Both guards are liars and they came up with this rouse to fuck with people because they were bored.
Necro raises first guard, compels him to kill second guard.
Necro raises second guard, has them each explore the path they blocked to check for danger
Barbarian street smarts ain’t by the book (or all that smart), but damn are they effective
Both guards told the truth in their first lines
Not if they were both lying. Both guards are liars.