Logical fallacy

Ad hoc rescue

Adds an unsupported auxiliary claim or exception to save a position from contrary evidence.

Also called Ad hoc hypothesis

A cracked experimental device with a patch improvised exactly over the failed test

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.
The added mode explains away exactly the test that failed and brings no independent evidence or checkable prediction.
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.