Skip to main content
Auto Restart is a Virtus Cloud exclusive technology that monitors the health of your application and automatically brings it back online when it crashes or becomes unresponsive. Instead of manually logging into the dashboard every time your bot or service goes down, Auto Restart detects the failure, validates that a restart makes sense, and relaunches your application — all without any intervention from you. This page explains how to enable the feature, how the restart decision logic works, and what error conditions are intentionally excluded from triggering a restart.

Enabling Auto Restart

You configure Auto Restart in your application’s configuration file. If you don’t have one yet, create a file named virtuscloud.app or virtuscloud.config in the root directory of your project.
1

Open your configuration file

Create or open your virtuscloud.app or virtuscloud.config file in the root of your project. This file controls runtime settings for your application on the platform.

Learn about the configuration file

The virtuscloud.app file defines your application’s name, description, version, entry point, memory allocation, and feature flags — including Auto Restart.
2

Locate or add the AUTORESTART parameter

Search the file for an existing AUTORESTART entry. If it’s not there, add it on a new line. The parameter must appear in the root of the file, not nested inside another block.
3

Set the value to true

Set AUTORESTART=true to activate the feature. Your configuration file should include the following line:
virtuscloud.app
AUTORESTART=true
4

Redeploy your application

Save the file and redeploy your application from the dashboard. Virtus Cloud reads the configuration file only during deployment, so changes don’t take effect until you trigger a new deploy.

How Auto Restart Works

When Auto Restart is enabled, the platform monitors your running application continuously. If the process exits, the system runs through a series of validation checks before deciding whether to restart. All conditions must pass for a restart to occur.
1

Application goes down

Your application’s process exits or becomes unresponsive. The platform detects the exit event and checks whether AUTORESTART=true is set in your configuration file. If it is, the restart evaluation begins.
2

Uptime verification

The platform checks how long your application was running before it exited. If the uptime was greater than 60 seconds, the evaluation continues. Applications that crash almost immediately are considered to have a configuration or code error — restarting them in a tight loop would consume resources without resolving the underlying issue.
3

Exit status verification

The platform inspects the process exit code. If the exit status is 1 (a general runtime error), the evaluation continues. A status of 0 typically means the process exited cleanly and intentionally, so no restart is needed.
4

Recent restart verification

The platform checks whether the application was already restarted within the last 60 minutes. If it has not restarted recently, the evaluation continues. This cooldown prevents a crash-loop from hammering your application and consuming your resource allocation.
5

Exception log verification

The platform scans the application’s recent log output for known unrecoverable error patterns. If any of the excluded errors are detected, the restart is cancelled — because restarting won’t fix a syntax error or a missing dependency. The excluded patterns are:
SyntaxError: Unexpected token 'X'
SyntaxError: Unexpected identifier 'X'
SyntaxError: Invalid or unexpected token 'X'
6

Application restarted

All checks passed. Auto Restart relaunches your application automatically.
There is a mandatory 60-minute cooldown between Auto Restart triggers. If your application crashes again within that window, it will not be restarted a second time until the cooldown expires.

Best Practices

Following these practices helps you get the most value out of Auto Restart while avoiding false negatives where the feature declines to restart a genuinely recoverable failure:
Each time Auto Restart triggers, open the Logs panel in the dashboard and read the output from the previous session. Recurring restarts usually signal an underlying problem — a memory leak, an unhandled promise rejection, or a third-party API that returns unexpected data. Addressing the root cause is always better than relying on Auto Restart indefinitely.
Auto Restart can only save your application from recoverable runtime errors. If your MAIN file path is wrong or your MEMORY value is too low for your actual workload, the application will keep crashing in ways that may not trigger a restart. Review both parameters whenever you update your project structure or increase its complexity.
If your logs contain a SyntaxError, MODULE_NOT_FOUND, or INVALID_DEPENDENCY message, Auto Restart will never fire — by design. Fix the code or dependency error first, redeploy, and then Auto Restart will be active for genuine runtime failures.
Auto Restart is a safety net, not a primary reliability strategy. Wrap critical async operations in try/catch blocks, use process-level uncaughtException and unhandledRejection handlers in Node.js, and add proper exception handling in Python to ensure your application recovers gracefully from expected edge cases without needing a full restart.