Running my Streamlit application (1.39) in snowflake and it is crashing on a fairly frequent basis with the error:
Failed to process a Websocket message (AxiosError: Request failed with status code 404)
It can happen on any page, at any point in the navigation, and it doesn’t seem to be related to any code or logic on any specific page. After the crash, I have to hit refresh, or back to leave the app, and then reenter the application.
I removed an st.fragment and integrated it into a normal part of the page, and I haven’t seen this error for a little bit. So, I’d recommend removing whatever fragment is on the page that you’re getting the error on.
Users of my app are reporting this same error, though it’s not every user and it’s not all the time for them. In this app, an st.dialog() is presented to the user for either adding or editing some data, within which the user can save their changes. After the changes are saved, I call st.rerun() to close the dialog programmatically, ensure the data in the UI is refreshed to reflect their changes, as well as other changes that may have been made by other users; this is when the error is shown to them.
I didn’t have the st.rerun() in a try-catch because I didn’t see it as necessary since the app was going to rerun anyways, which resulted in a blank white screen with the error, forcing a manual reload to resolve.
As a temporary workaround until Streamlit can resolve the issue, I’ve added a retry for the st.rerun() call, and if that fails, it simply displays a warning to the user indicating that they need to do one of the following to see their changes:
Reload the page manually.
Use the pagination controls we have to navigate to another page and back again to where they were.
It states in the documentation for st.dialog() that st.dialog() inherits from st.fragment(), so I can safely assume that this is the same issue you and others are reporting. Let me know if any advances in this are made! I would love to remove this workaround I came up with.
P.S. I tried making the data loading logic in this app cached and writing a cache invalidation method in that class to try and refresh the data manually rather than using st.rerun(), but this doesn’t invalidate the UI elements [obviously] and results in the same behavior where you have to either manually reload or navigate away and come back again. The only way I could think of resolving this would be to use JavaScript to manually crawl through DOM elements, clearing them out, and rebuilding them by calling our render() method, but since this app is a Streamlit-in-Snowflake app, using JavaScript is not an option.
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.