How to use Auto Restart on Square Cloud
What Auto Restart is
Auto Restart restarts your application automatically when it exits with an error, with protections against restart loops, helping keep it available without any manual action. It is off by default (AUTORESTART=false).
How to enable it
In your squarecloud.app (or squarecloud.config) file, add:
AUTORESTART=trueHow it works
When AUTORESTART is enabled and your app crashes, Square Cloud runs a series of checks before restarting it:
- The app exited with status 1 (an unhandled error). A frozen process that doesn't exit, or an app stopped for lack of RAM, is not restarted.
- The app's uptime was more than 60 seconds.
- The app's exit status was 1.
- The app hasn't restarted in the last 60 minutes.
- The logs don't contain an excluded error: an invalid bot token, a missing module, a syntax or TypeScript type error, or a failed dependency install. In those cases Auto Restart will not restart the app, because restarting wouldn't fix the problem.
If all the conditions are met, the app is restarted automatically. There is a 60-minute cooldown between automatic restarts.
Best practices
- Review your logs regularly to understand why the app is crashing — Auto Restart keeps it online, but it doesn't fix the root cause.
- Keep your
MAINfile and memory allocation correct and up to date.
Related
For more ways to maximize availability, see How to keep bots online 24/7. If your app keeps crashing on boot, the logs usually point to the cause — see My application won't start: Verifying the start script.
Updated on: 10/04/2026
Thank you!
