Weird automation behaviour

So I’m having a slightly strange automation issue.

9 times out of 10 the automation works perfectly, but there have been occasions where the light does not turn off, which it should following the automation.

The automation is a motion activated light, with sun condition and timeout of 120 seconds.

I have found now that on 2 or 3 occasions the light after activation from the automation, has just stayed on indefinitely.

Any ideas? Can post same yaml later when I get home.

Thanks

Also, if possible, post the automation’s trace when this happened :