A duplicate digit or a cell with no legal candidates means something in the current grid needs review. Resist the urge to erase the whole page. First identify the conflicting row, column, or box and note which entries were printed clues and which you added.
Printed clues belong to the puzzle as supplied. Check that you copied them correctly if you are working from a screen or another sheet. A transcription error can resemble a logical error, so compare the source before reconstructing a long chain of deductions.
Review your most recent added entries in the affected units. For each one, ask for the original reason. "It looked right" is not a recoverable proof. A note such as "only place for 8 in column 6" can be checked against the earlier state if you kept a move log.
If the error came from a hypothetical branch, undo that branch as a group. If you cannot separate assumptions from confirmed deductions, return to the last saved clean state. Keeping a photo or a short checkpoint note during a difficult paper solve can make this much easier.
Once the conflict is removed, recompute candidates in the affected cells. Do not restore every erased pencil mark by memory. A mistaken final digit may have caused several valid-looking eliminations that no longer apply. The recovery is complete only when the grid and its notes agree again. Finding the source of an error is useful practice in checking reasons, even when the puzzle takes longer to finish.
Sources & notes
Original puzzle teaching and explanation by Evan Tessell.