The "Association Indication" command always returns the code "0xFF"

mvut,

During testing I set the maximum time to wait for a response from AS to 300 seconds and during this time the response did not come…

To summarize:
Active scanning (AS) works properly for some time. At one of the moments of exiting cyclic sleep, I send the DJ: 1, then NR, and then AS command as usual, but there is no response (in the logs I waited 8 seconds, but previously I waited longer). Then I send DJ: 1, then NR, and then AS again and then I get an error code from AS. After 3 seconds the situation repeats itself and the endpoint no longer scans and always returns an AS error. This happens both with a connected coordinator and without one nearby.

Please tell me what should be avoided so that there is no error in response to AS?
If an error occurs, how can I fix it?