The ScriptedDashboard URL does not work first time after login but works fine after refresh

The scripted dashboard is called through a URL. The URL does not work the first time but runs properly after refreshing. It is happening after I have upgraded to grafana version [8.4.10].
Can any one help!
Thanks in advance.
Getting the below error.