# Start a server in safe mode

> Start a Minecraft Java world once with only the vanilla datapack, to recover from a datapack that stops it loading.

Source: https://docs.coritan.com/managed-containers/software/safe-mode/

In the dashboard:

- /dashboard/servers/…/software: https://www.coritan.com/dashboard/servers

When a datapack fails to load, a Minecraft Java server stops during startup, and the [console](/managed-containers/console/) shows:

```text
Failed to load datapacks, can't proceed with server load. You can either fix your datapacks or reset to vanilla with --safeMode
```

*Safe mode* starts the server once with Minecraft's `--safeMode` option. The world loads with only the vanilla datapack, so the server comes up and you can fix or remove the datapack that broke it. The **Safe mode** panel on a server's **Software** tab adds the option for one start only: the next start after that is a normal one.

## Before you begin

- Safe mode works on Minecraft Java 1.16 and newer, with plugin servers such as Paper, with Vanilla and with mod loaders such as Fabric and Forge. Proxies load no datapacks, and Bedrock servers have no safe mode.
- Take a [snapshot](/managed-containers/snapshots/) of the server first. Safe mode also skips the datapacks that were working, and you are about to change the world's files.
- On a server someone shared with you, you need the Install software permission, and the Power permission to start the server from the panel.

## Start in safe mode now

1. In the [dashboard](https://www.coritan.com/dashboard/servers), go to **Container Apps** and open the server, then the **Software** tab.
2. Select **Safe mode**.
3. Select **Start in safe mode**.

A running server restarts, and a stopped one starts. The badge on the panel shows **Running in safe mode** once the server is up.

## Arm safe mode for the next start

To choose when the server starts, arm safe mode instead:

1. On the **Safe mode** panel, select **Arm for the next start**. The badge shows **Armed for next start**.
2. Start the server from the [console](/managed-containers/console/) when you are ready, or select **Start now** on the panel.

To cancel before the server starts, select **Disarm safe mode**.

## Fix the world and restart normally

While the server runs in safe mode, the panel warns `The server is running in safe mode now. Fix or remove the datapack that broke it, then restart normally.`

1. Find the datapack that failed. The error lines in the [console](/managed-containers/console/) before the message above name it.
2. Remove it, or replace it with a build that works with your Minecraft version. Datapacks are in the world's `datapacks` folder, such as `world/datapacks`. Remove them on the [Installed addons](/managed-containers/software/installed-addons/) panel or in the [Files tab](/managed-containers/files/).
3. Restart the server from the [console](/managed-containers/console/).

As soon as the safe-mode start stops, safe mode switches itself off, and the badge shows **Off**. If you restart without fixing the datapack, it can stop the server again.

## Result

The server starts on the vanilla datapack alone, and the console shows the world loading. After the normal restart, the world loads with the datapacks that remain in its folder.

## Troubleshooting

**Safe mode is not available here**
: The server's software cannot use the option. The panel gives the reason, such as `Safe mode needs Minecraft 1.16 or newer.` or `A proxy loads no datapacks, so there is nothing for safe mode to skip.` On a Bedrock server, remove the broken pack as [Manage Bedrock packs](/managed-containers/software/bedrock-packs/) describes.

The panel says `Starting in safe mode.` but the server does not start
: The start was refused, as it is while a free server waits in the queue to wake or while we have locked the server. Safe mode stays armed, so the server uses it the next time it starts. Start it from the [console](/managed-containers/console/) when you can.

The world still does not load in safe mode
: Safe mode skips datapacks only. When the console shows another error, such as a broken mod or plugin, remove that instead. [Troubleshoot servers](/managed-containers/troubleshooting/) lists common causes.

The same error comes back after the normal restart
: The broken datapack is still in the world's `datapacks` folder. Start in safe mode again and remove it.

## Related

- [Manage installed addons](/managed-containers/software/installed-addons/)
- [Use the console and power controls](/managed-containers/console/)
- [Troubleshoot servers](/managed-containers/troubleshooting/)

## With the API

```bash
curl -X POST https://api.coritan.com/api/v1/client/servers/$SERVER/software/safe-mode \
  -H "Authorization: Bearer $CORITAN_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"enabled": true, "start": true}'
```

| Field | What it does |
| --- | --- |
| `enabled` | Required. `true` arms safe mode for the next start. `false` disarms it. |
| `start` | With `"enabled": true`, `true` also restarts a running server or starts a stopped one. |

The response has `state` (`off`, `armed` or `active`), `armed`, `active`, `flag` (`--safeMode`) and `synced`. With `start`, `started` says whether the server started, `action` says whether we sent `start` or `restart`, and `start_error` gives the reason when the start was refused. Safe mode stays armed after a refused start.

`GET /api/v1/client/servers/{uuid}/software/context` shows the same state under `safe_mode`, with `supported` and `unsupported_reason`.

Arming on software that cannot use safe mode answers `400` with the reason, and a body without `enabled` answers `400` with `enabled is required`. Arming needs `software.install`, and `start` also needs `control.start`.

## API

- `POST /api/v1/client/servers/{uuid}/software/safe-mode`: Arm a one-shot --safeMode start (vanilla datapack only), optionally starting now (https://docs.coritan.com/api/reference/client/container-apps/servers-software/#op-post-api-v1-client-servers-uuid-software-safe-mode)
