# The app did not start

> start_failed — built, but the app or bot stopped after starting or never answered. The common causes.

Source: https://livops.dev/en/docs/error-start

`start_failed` — the build passed, but the app did not answer within a minute, or the bot stopped after it started. The reason is on the **Logs** page: the app's last words, often with a **Tip:** line under them. A web app's previous version keeps running. A bot's is stopped before the new one starts, because two copies polling Telegram would conflict, so the bot is down until a deploy succeeds.

## A variable is not set

The most common cause. The app expects a value like `BOT_TOKEN`, `DATABASE_URL`, `SECRET_KEY`. The log names it: `KeyError: 'BOT_TOKEN'`, pydantic's `Field required`, Spring's `Could not resolve placeholder`. Add it in **Settings → Variables** and deploy again. An `.env` file does not reach the repository — the values go there instead.

## The bot token is empty or wrong

The log says `TokenValidationError` or `InvalidToken`. Put the token BotFather gave you in Variables, under the name the code reads (often `BOT_TOKEN`).

## Python could not find a module

The log says `No module named 'X'`. If it is a library, add it to `requirements.txt`. The import name and the package name sometimes differ:

| Import | In requirements.txt |
| --- | --- |
| `PIL` | `Pillow` |
| `cv2` | `opencv-python-headless` |
| `yaml` | `PyYAML` |
| `dotenv` | `python-dotenv` |
| `telegram` | `python-telegram-bot` |

If it is a folder of your own (`config`, `data`), check that it is committed with its files and that `.gitignore` did not drop it.

## The app listens on `localhost`

Then only the container itself can reach it. Listen on `0.0.0.0` and the port in the `PORT` variable:

```js
app.listen(process.env.PORT || 3000, '0.0.0.0')
```

```sh
uvicorn main:app --host 0.0.0.0 --port $PORT
```

## The app waits for a database

The log says `ECONNREFUSED 127.0.0.1:5432` or `Connection refused`. Add a database to the project (**Databases**) or put an external database's address in `DATABASE_URL`.

## The database has no tables

The log says `no such table` or `relation ... does not exist`. Make the migration the **pre-deploy command**:

```sh
.venv/bin/python manage.py migrate --noinput
```

## Django refuses the address

The log says `DisallowedHost`. In `settings.py`:

```python
ALLOWED_HOSTS = os.environ.get('ALLOWED_HOSTS', '').split(',')
```

and in Variables `ALLOWED_HOSTS=.livops.app`.

## Out of memory

The app used more memory than its plan allows and was stopped (the log says `Killed`, or exit code 137). Choose a bigger plan in Settings, or use less memory.

## The program finished on its own

The bot printed nothing and exited with code 0 — it ran to the end. A library, a one-off script or a command-line tool does that. A bot keeps running: `start_polling()`, `bot.launch()`, `bot.start()`. Check that the start command runs the bot itself.

## The program asked a question and waits

The last line has `(y/N)` or `Press enter`. Nobody answers here. Pass the answer as an option or a variable.

## Files disappear on every deploy

Files written to `/tmp` or next to the code are gone after the next deploy. Write them to `/app/data` (the `DATA_DIR` variable) or a database. See [Files](https://livops.dev/en/docs/files).

## `predeploy_failed`

The pre-deploy command (a migration, say) ended with an error. The new version was not started; the old one is still serving. What it said is in the log.
