# Migrate a legacy configuration

If you are upgrading the SeaLights ABAP Agent from v0.65 or earlier, your existing `config.toml` file uses the legacy format (version 0). Starting from v0.66, the agent requires configuration version 1. Any command you run against a legacy config will fail with the following error:

```
[error] Config version 0 is not supported (minimum: 1). Run the `slabapcli setup migrate` command to migrate your config.
```

Follow the steps below to migrate your configuration before continuing with the agent setup.

{% hint style="warning" %}
**Before you migrate:** Back up your `config\config.toml` file. The migration modifies the file in place and cannot be undone automatically.
{% endhint %}

## Run the migration

{% hint style="warning" %}
**End and disable all Sealights scheduled tasks** in the Windows Task Scheduler before running the migration. The migration will warn you to do this — make sure they are stopped before you confirm.
{% endhint %}

Run the following from your PowerShell window:

{% code title="Command" overflow="wrap" %}

```powershell
.\slabapcli.exe setup migrate
```

{% endcode %}

{% code title="Expected output" overflow="wrap" lineNumbers="true" %}

```powershell
C:\apps\SLABAPAgent\bin>slabapcli setup migrate
[2026-03-08 13:43:42.193+02:00] [info] Detected Windows version: Windows 11
[2026-03-08 13:43:42.195+02:00] [info] Config pathname: ../config/config.toml
[2026-03-08 13:43:42.205+02:00] [info] Config version 0 detected. Migration to version 1 is required.
[2026-03-08 13:43:42.205+02:00] [warning] Please make sure to End and then Disable all Sealights scheduled tasks in the Windows Task Scheduler.
Continue? [Y/n]
```

{% endcode %}

* Enter `Y` (or press **Enter**) to proceed with the migration.
* Enter `n` to cancel. The config file will not be changed.

When you confirm, the migration runs and writes the updated file:

{% code title="Expected output (continued)" overflow="wrap" lineNumbers="true" %}

```powershell
[info] Starting config migration from version 0 to 1
[info] Applying v0 -> v1 migration: setting version and populating pipeline appname fields
[info] Config successfully migrated to version 1.
[info] Config migrated and written to '../config/config.toml'
```

{% endcode %}

## What the migration does

| Change              | Details                                                                                         |
| ------------------- | ----------------------------------------------------------------------------------------------- |
| Sets config version | Adds `version = 1` to the root of `config.toml`                                                 |
| Backfills `appname` | Populates the `appname` field for each existing pipeline, derived from the legacy pipeline name |
| Backfills `labid`   | Populates any missing `labid` fields                                                            |

## After migration

Once the migration completes successfully, re-enable your scheduled tasks in the Windows Task Scheduler and continue with the agent setup.

If you run `setup migrate` on a config that is already at version 1, the command exits safely with no changes:

```
[info] Config already at version 1.
```
