Avoiding it often depends on your camera.
The cause is usually recording to tape and either ejecting the tape and later putting it back in and recording again or switching to “vcr” mode rewinding and playing back the tape and then cueing it up to a blank portion of the tape to begin recording again.
Sony DVcam camera and perhaps other manufacturers have various timecode options, such as preset timecode, free run, rec run, regen, etc… In most cases leaving the camera in Rec Run and Regen will help to avoid some problems. Often on multiple tape shoots the shooter will often number the tape using the timecode’s hour mark, using a preset timecode of 1:00:00:00 for the first tape, 2:00:00:00 for the second and so on. Tricky part is remembering to switch the mode from preset to regen if you happen to turn the camera off and back on, removing the tape, switching to VCR, etc…
The majority of other consumer DV cameras don’t have as many complicated timecode options, simply rewinding or fast forwarding the tape to a section that has timecode the camera is smart enough to continue the timecode from that point.
For these reasons it is always good practice to shoot a little extra junk footage at the end of recording your subject (some people record color bars) to ensure that you have enough to fast forward the tape to an area where you have timecode but don’t overwrite footage that is important.
Erik