Logical fallacy
Ad hoc rescue
Adds an unsupported auxiliary claim or exception to save a position from contrary evidence.
Also called Ad hoc hypothesis
Examples
The device failed the announced test. It must have a unique mode that disables it only during independent testing, which is the only evidence for that mode.
My map predicted a river here. There isn't one, so I add an invisible river that has no observable effects.
After the count finds no missing cards, the speaker invents a replacement behavior they have no separate evidence for.
A similar case that can be sound
An independent calibration test uncovers an instrument error and the updated prediction is tested in a new experiment.