The idiom identifies a kind of logical fallacy. In an argument, when evidence is presented in response to a specific claim, it is "moving the goalposts" when some other evidence is demanded instead. Idioms are a common stumbling block for learners of a language.