Homing concept and problems with missed steps

Continuing the discussion from Lost home during sequence execution:

So when I home my z axis and switch on the full debug level in the logs, the Z axis sometimes gets stuck on its way up (this has not happened before, I did not change anything on the system…!!!)

Thats what the debug = 3 logs say:

`TYPE MESSAGE POSITION (X, Y, Z) TIME
3

Debug Arduino debug message: error 0 359, 718, 0 May 26, 2:58pm
3

Debug Arduino debug message: stopped 359, 718, 234 May 26, 2:58pm
3

Debug Arduino debug message: deactivate motor Z due to missed steps 359, 718, 234 May 26, 2:58pm
3

Debug F13 359, 718, 400 May 26, 2:58pm
2

Busy Finding home on z axis. 359, 718, 400 May 26, 2:58pm`

How is this problem thought of that if during the homeing the encoder measures missed steps that they are not accidentally taken as the new home?

no idea how to solve this @Gabriel?