Elimination of downhole accidents in well operation and repair