I ran into exactly the same issue recently. Every time I tried to deploy an app on Streamlit Cloud, the “App URL” field showed “Unexpected error”, even when I left the field empty. Repo was correct, branch was correct, main file was correct and still the Deploy button stayed disabled.
After several tests, here’s what I found and what actually solved it:
The error was not caused by my code or my repo
I tried deploying a minimal “hello world” app in a clean public repository and the same error happened. So the problem was not related to Python, Streamlit version, requirements, or file structure.
The issue was related to my Streamlit Cloud account
It turns out that my account had been automatically flagged by Streamlit’s system (likely for “suspicious” or unusual usage). When this happens, the platform silently blocks new deployments including validating the App URL and the UI only shows “Unexpected error”.
What fixed it
I contacted Streamlit/Snowflake support and asked them to review/unblock my account.
After they removed the flag, deployment worked immediately and the “Unexpected error” disappeared.
What you can check before contacting support
Make sure your GitHub repo is public.
Try deploying a fresh minimal repo (just a simple streamlit run script).
If even that fails with the same error, your account is very likely flagged.
Conclusion
If everything in your repo looks correct and the error happens even with simple apps, the fastest fix is to open a support ticket and ask them to review your Streamlit Cloud account. That’s what solved it in my case.