Browse documentation

Why won't my app start?

A Container that crashes, restarts or never comes online: how to read the console and fix a missing main file, missing packages, address already in use, missing variables and out of memory.

CanerAkar
On this page

When a Container does not start, the Console tells you why. Start the server and read the last lines before it stops: they almost always name the problem. The most common causes are a main file the server cannot find, a package that is not installed, a port that is already in use, a missing environment variable, or a plan that runs out of memory. This page shows the message for each one and how to fix it.

Run your Python script for free

Read the console first

  1. Go to panel.fps.ms and click Manage on your server.
  2. Click Console, then Start or Restart.
  3. When the server stops, scroll up to the first error. FPS.ms then prints Detected server process in a crashed state! and an Exit code.

In a Python Traceback, the last line is the error and the lines above it show where it happened. In Node.js, the first line that starts with Error: is the one that matters.

The server cannot find your main file

python: can't open file '/home/container/app.py': [Errno 2] No such file or directory
Error: Cannot find module '/home/container/index.js'

The server starts one file, app.py on Python and index.js on Node.js, from the main folder. Fix it one of these ways:

  • Rename your file, or type its name in App py file (Python) or Main file (Node.js) on the Startup tab.
  • Move the file out of a subfolder, or type the path, like src/bot.py.
  • Did you upload a .zip? Unarchive it in Files first.

Other runtimes print their own message, like No runnable jar found after the build. on Java. The supported runtimes page lists the file or project each one looks for.

A package is not installed

ModuleNotFoundError: No module named 'discord'
Error: Cannot find module 'discord.js'
  • Python: add the package to requirements.txt in the main folder. See installing Python packages.
  • Node.js: add the package to dependencies in package.json in the main folder, for example with npm install discord.js on your computer. The server runs npm install on every start.

Address already in use (EADDRINUSE)

Error: listen EADDRINUSE: address already in use 0.0.0.0:3000
OSError: [Errno 98] Address already in use

Your app tries to open a network port that something else already holds. The usual causes:

  • A hardcoded port. Your app uses a fixed port like 3000, 5000 or 8080. Use the port in the SERVER_PORT environment variable instead. See put a web app online for examples.
  • Two listeners in one app. For example a web server and a dashboard both on the same port. Give one of them another port, or let one serve both.
  • A second copy of your app. A process your code started in the background is still running. Stop the server, wait until it is offline, then start it again.

A port below 1024, like 80 or 443, fails with EACCES or Permission denied. Use SERVER_PORT: FPS.ms handles HTTPS on your Public URL.

An environment variable is missing

KeyError: 'BOT_TOKEN'
Error [TokenInvalid]: An invalid token was provided.

Your code reads a variable that is not set, or is set to the wrong value. Add it on the Environment tab, check the name for typos and capitals, and restart. Variables only reach your app after a restart. See environment variables.

The server ran out of memory

Your server ran out of memory: it used all 128 MB of its plan and was stopped.

Your app, or its build, needed more memory than your plan has. A Killed line in the output means the same.

  • Install only the packages you use. Big libraries like pandas or torch need a lot of memory.
  • Builds need more memory than running: Java and Kotlin with Gradle need about 1 GB.
  • Upgrade the server to a plan with more memory.

It starts and stops right away, with Exit code 0

Your code finished. A script that runs once and ends stops the server. A bot or a web app has to keep running: check that your code reaches client.run(...), bot.start() or app.listen(...) and does not return early. To run a script on a timer, create a schedule on the Schedules tab that starts the server.

A GitHub deploy failed

Open the Deployments tab and click View log. The last lines of the build name the problem. See deploy from GitHub.

Still stuck?

Copy the error lines from the console and open a ticket, or ask in our Discord. Never paste a token or password: replace it with ***.

Next steps

Run your Python script or bot for free.

Upload your code, add your environment variables and keep it running 24/7.

Run your script free