# Stalwart-migrate 1.0.3: accounts with no change counter are skipped without warning (their mail is not copied, final run and verify pass)

**URL:** https://support.stalw.art/t/stalwart-migrate-1-0-3-accounts-with-no-change-counter-are-skipped-without-warning-their-mail-is-not-copied-final-run-and-verify-pass/2113
**Category:** Issues
**Created:** [October 29, 2026, 12:48pm UTC](https://support.stalw.art/t/stalwart-migrate-1-0-3-accounts-with-no-change-counter-are-skipped-without-warning-their-mail-is-not-copied-final-run-and-verify-pass/2113 "2026-10-29T12:48:48Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![sphen13](https://support.stalw.art/user_avatar/support.stalw.art/sphen13/32/330_2.png) [@sphen13](https://support.stalw.art/u/sphen13)
#### Post date: [October 29, 2026, 12:48pm UTC](https://support.stalw.art/t/stalwart-migrate-1-0-3-accounts-with-no-change-counter-are-skipped-without-warning-their-mail-is-not-copied-final-run-and-verify-pass/2113/1 "2026-10-29T12:48:48Z")

</div>

### Issue Description

`stalwart-migrate run` (and `run --final`, `verify --full`) silently skips registered accounts that have no per-account change counter in the v0.16 store. All runs report `ok`, `errors: 0`, and verification reports `0 mismatches`, because the skipped accounts never enter the account list. In our case 4 of 8 accounts were skipped, including two mailboxes with about 96 GB of mail (roughly 279,000 messages).

With a shared blob store (`mode = "reuse"`, the recommended answer), the skipped accounts’ blobs are not referenced by anything in the v1 store. As we read the docs, 1.0 deletes unreferenced blobs, so cutting over would eventually lose that mail with no warning anywhere in the process. We caught it only because the account count looked wrong.

**Cause (from the 1.0.3 source)**

`crates/source-v016/src/adapter/principal.rs`, `accounts()`, lists accounts by iterating the counter subspace for 4-byte keys (the per-account `ChangeId` counter). `adapter/mod.rs` then intersects that with  
`registry::account_ids()`:

```rust
let mut accounts = principal::accounts(&data).await?;
let registered = registry::account_ids(&data).await?;
accounts.retain(|account| registered.contains(account.account_id));

```

An account that is registered and has data, but has never had a change written under the current key layout, has no counter key, so it’s never listed. Over JMAP, all four skipped accounts had `Mailbox/get` `state = "n"`. All four accounts that were copied had real states (`sam`, `svypq`, …).

How the accounts got there:

- Two were large mailboxes whose data dates from older versions. The store was created in January 2025 and went 0.15 → 0.16 in place with `migrate_v016.py`. Those mailboxes have had no changes since.
- Two were created automatically by 0.16 when an LDAP-directory address was looked up, and were never used.

### Expected Behavior

Every registered account is migrated. Or, if an account can’t be listed for some reason, the run reports it as an  
error, and `run --final` refuses to finalise.

### Actual Behavior

`account pass started accounts=4 removed=0`, where the registry holds 8 Account objects. `status` shows `Accounts: 4 / done 4`. `verify --sample 100` checks 4 accounts, 0 mismatches. Nothing appears in `report`.

### Reproduction Steps

1. A v0.16.27 store (RocksDB data store, file system blob store) containing an account that has data but whose `ChangeId` counter key is absent. Two ways to get one: an account that hasn’t changed since before the store was upgraded in place, or one that 0.16 created on directory lookup and that was never used. JMAP shows `Mailbox/get` state `n` for it.
2. `stalwart-migrate prepare`, then `stalwart-migrate run`.
3. Compare `account pass started accounts=N` (or `status`) with the number of Account objects in the registry.

**Workaround**

Write any change to each affected account on 0.16 before the final run, so the counter is created. As the recovery admin over JMAP, we created and then destroyed an empty mailbox in each account:

```json
["Mailbox/set", {"accountId": "<id>", "create": {"t": {"name": "zz-migrate", "parentId": null}}}, "c"]
["Mailbox/set", {"accountId": "<id>", "destroy": ["<created id>"]}, "d"]

```

The next incremental `run` listed all 8 accounts and copied the missing ones (279,089 emails). `run --final --verify-full` then passed with 8 accounts and 0 mismatches. The migrated server has been working since.

**Suggested fix**

- Build the account list from the registry, and treat a missing counter as change counter 0.
- Have `run --final` and `verify` compare the registry’s Account count with the tracked accounts, and fail on a difference.

### Relevant Log Output

```INFO
INFO migrate::orchestrator::job: account done account_id=105 checkpoint=3
INFO migrate::orchestrator::job: account done account_id=104 checkpoint=3
INFO migrate::orchestrator::job: account done account_id=98 checkpoint=4014
INFO migrate::orchestrator::job: account done account_id=34 checkpoint=3
INFO migrate::orchestrator: run finished run_id=1 status=ok ... "accounts_full":4,"errors":0 ...
verify: 4 accounts checked, 0 mismatches, 0 not explained by earlier reports (ok)

-- after touching accounts 38, 94, 106, 107 --
INFO migrate::orchestrator::account: account pass started accounts=4 removed=0
INFO migrate::orchestrator::job: account done account_id=107 checkpoint=3
INFO migrate::orchestrator::job: account done account_id=106 checkpoint=3
INFO migrate::orchestrator::job: account done account_id=38 checkpoint=2
INFO migrate::orchestrator::job: account done account_id=94 checkpoint=2
INFO migrate::orchestrator: run finished run_id=3 status=ok ... "accounts_full":4,"accounts_unchanged":4,"emails_written":279089 ...

```

### Stalwart Version

v1.x

### Installation Method

Binary (Linux)

### Database Backend

RocksDB

### Blob Storage

Filesystem

### Search Engine

Internal

### Directory Backend

LDAP

### Additional Context

This differs from “Missing Emails after v1.0.0 migration” (#2069), which was caused by  
starting 0.16 against the new store.

### I have reviewed the documentation and FAQ and confirm that my issue is NOT addressed there.

on

### I have searched this support forum (open and closed topics) and confirm this is not a duplicate.

on

### I understand that topics in this category are triaged by a bot first but a human reply will follow up. If I’d prefer a human-only reply, I’ll add the no-ai tag to my topic.

on

---

<div class="post-metadata">

### Author: ![helpbot](https://support.stalw.art/user_avatar/support.stalw.art/helpbot/32/13_2.png) [@helpbot](https://support.stalw.art/u/helpbot)
#### Post date: [October 29, 2026, 12:48pm UTC](https://support.stalw.art/t/stalwart-migrate-1-0-3-accounts-with-no-change-counter-are-skipped-without-warning-their-mail-is-not-copied-final-run-and-verify-pass/2113/2 "2026-10-29T12:48:57Z")

</div>

Thanks for the detailed report. I couldn’t find anything in the current docs that mentions accounts without a change counter, so I can’t confirm your diagnosis from the documentation. I also couldn’t locate the `source-v016` adapter source in the repos I can search, so I haven’t verified the `accounts()` logic you quote.

The docs say `verify` checks the accounts the migration tracked. They describe `--sample` as a percentage of accounts and `--full` as “every account”. They don’t say how the account list is built. That matches what you saw: if an account never enters the list, `verify` can’t flag it. Reading the docs alone, I can’t say whether this is intended, so it needs a human to confirm.

Until someone confirms, your workaround looks sensible. Before the final run, compare the number of Account objects in the registry with the `accounts=N` count in the log (or in `status`). If you write a change to each missing account on 0.16 so the counter exists, you can then confirm that all accounts are copied. Other people reading this should do the same check, especially with `mode = "reuse"`, because unreferenced blobs could be lost.

Relevant docs: [Verifying the migration | Stalwart](https://stalw.art/docs/migration/upgrade-0-16/verify)

This isn’t covered in the current docs. A community member or staff member will follow up.

_This is an automated reply from the Stalwart Help Bot. Other community members may follow up if this answer is incomplete or wrong._

---

<div class="post-metadata">

### Author: ![sphen13](https://support.stalw.art/user_avatar/support.stalw.art/sphen13/32/330_2.png) [@sphen13](https://support.stalw.art/u/sphen13)
#### Post date: [October 29, 2026, 12:51pm UTC](https://support.stalw.art/t/stalwart-migrate-1-0-3-accounts-with-no-change-counter-are-skipped-without-warning-their-mail-is-not-copied-final-run-and-verify-pass/2113/3 "2026-10-29T12:51:59Z")

</div>

For whoever picks this up, the code is in the stalwart-migrate repo (tag v1.0.3):

- Account listing from the counter subspace: [stalwart-migrate/crates/source-v016/src/adapter/principal.rs at 97260054c8658ac76ee671a2dd39b6ea9b82e811 · stalwartlabs/stalwart-migrate · GitHub](https://github.com/stalwartlabs/stalwart-migrate/blob/97260054c8658ac76ee671a2dd39b6ea9b82e811/crates/source-v016/src/adapter/principal.rs#L58)
- Intersection with the registry: [stalwart-migrate/crates/source-v016/src/adapter/mod.rs at 97260054c8658ac76ee671a2dd39b6ea9b82e811 · stalwartlabs/stalwart-migrate · GitHub](https://github.com/stalwartlabs/stalwart-migrate/blob/97260054c8658ac76ee671a2dd39b6ea9b82e811/crates/source-v016/src/adapter/mod.rs#L346-L352)

Quick check on any 0.16 server: `Mailbox/get` on an account that returns `state: "n"` means there’s no change counter, and such an account won’t be listed by `run`.

---

<div class="post-metadata">

### Author: ![stalwart](https://support.stalw.art/user_avatar/support.stalw.art/stalwart/32/12_2.png) [@stalwart](https://support.stalw.art/u/stalwart)
#### Post date: [October 30, 2026, 6:19pm UTC](https://support.stalw.art/t/stalwart-migrate-1-0-3-accounts-with-no-change-counter-are-skipped-without-warning-their-mail-is-not-copied-final-run-and-verify-pass/2113/4 "2026-10-30T18:19:51Z")

</div>

@sphen13 this is fixed in stalwart-migrate 1.0.4, which came out today. The account list now comes from the registry, and an account without a ChangeId counter is listed with counter 0. That means it gets a full copy on the next run, and verify checks it like any other account. Rollback had the same gap and is fixed too.

You’ve already finished with the create-and-delete-a-mailbox workaround, so there’s nothing left for you to do. Anyone who migrated with 1.0.3 or earlier and is already on 1.0 should compare the number of accounts with data on both sides. An account that only exists on 0.16 is one this bug skipped.
