DkimSignature error during migration 0.16.27 -> 1.0.0

Issue Description

When trying to migrate from 0.16.27 to 1.0.0 the process stalwart-migrate run --final fails because of 14 errors.

The stalwart-migrate report reports the following details:

stalwart-migrate report --severity error --state /opt/stalwart-mail/migrate
run    severity category   account    object               id                   message
1      error    failed     -          x:DkimSignature      307011041519206400   rejected by v1: Invalid foreign key: Domain with id b
1      error    failed     -          x:DkimSignature      307011041523404800   rejected by v1: Invalid foreign key: Domain with id j
1      error    failed     -          x:DkimSignature      307011041523406336   rejected by v1: Invalid foreign key: Domain with id m
1      error    failed     -          x:DkimSignature      307011041525505024   rejected by v1: Invalid foreign key: Domain with id p
1      error    failed     -          x:DkimSignature      307011041525505536   rejected by v1: Invalid foreign key: Domain with id q
1      error    failed     -          x:DkimSignature      307011041527603712   rejected by v1: Invalid foreign key: Domain with id b
1      error    failed     -          x:DkimSignature      307011041535996416   rejected by v1: Invalid foreign key: Domain with id j
1      error    failed     -          x:DkimSignature      307011041540192256   rejected by v1: Invalid foreign key: Domain with id m
1      error    failed     -          x:DkimSignature      307011041544388096   rejected by v1: Invalid foreign key: Domain with id p
1      error    failed     -          x:DkimSignature      307011041546485760   rejected by v1: Invalid foreign key: Domain with id q
1      error    failed     -          x:DkimSignature      307011041521304576   rejected by v1: Invalid foreign key: Domain with id d
1      error    failed     -          x:DkimSignature      307011041523405312   rejected by v1: Invalid foreign key: Domain with id k
1      error    failed     -          x:DkimSignature      307011041529701888   rejected by v1: Invalid foreign key: Domain with id d
1      error    failed     -          x:DkimSignature      307011041538094080   rejected by v1: Invalid foreign key: Domain with id k
14 rows

Reproduction Steps

  1. Create new config.json file with RocksDb store
  2. Run stalwart-migrate prepare
  3. Run stalwart-migrate run
  4. Run stalwart-migrate report

Stalwart Version

v1.x

Installation Method

Binary (Linux)

Database Backend

RocksDB

Blob Storage

RocksDB

Search Engine

Internal

Directory Backend

Internal

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

The error means the migrator tried to write 14 DKIM signatures into 1.0, but each one points to a Domain id that doesn’t exist in the target store. The 1.0 registry rejects any object whose foreign key doesn’t resolve. I couldn’t find the cause of the missing domains in the docs or source, so I can’t say whether this is a tool bug or leftover data in your 0.16 store.

The domain ids in your report are single letters (b, d, j, k, m, p, q). That suggests the 0.16 keys refer to domains that were deleted, or that were never copied. The 14 failures cover only 7 distinct domains, with two signatures each, which fits one RSA key and one Ed25519 key per domain.

To narrow it down, you could try this:

  1. List every row for the same run, not just errors, and look for dropped or skipped rows on Domain objects: stalwart-migrate report --state /opt/stalwart-mail/migrate --run 1 --category dropped (and --category skipped). If those domains were dropped, that explains the rejected keys.
  2. Compare the domains in your 0.16 setup with the seven ids. If the 14 signatures belong to domains you no longer use, they are leftovers and safe to lose.
  3. If the domains are no longer in use, you can finalize with stalwart-migrate run --final --allow-errors. Afterwards, create the DKIM keys again in 1.0 for any domain you still need. If a domain is still in use, don’t finalize until you know why it wasn’t copied.

The verify page describes the report categories and --allow-errors. The troubleshooting page lists the known refusals. Neither covers this specific error.

If you post the rows for the Domain object from the report, plus the list of domains in your 0.16 setup, a human can tell whether this is a tool bug.

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

The full report doesn’t contain any (skipped or dropped) domains:

$ stalwart-migrate report --category dropped  --state /opt/stalwart-mail/migrate
run    severity category   account    object               id                   message
1      warning  dropped    -          AcmeProvider         309935511047278592   warning: x:AcmeProvider/iti2wsdubeaa maxRetries: dropped (no equivalent in the target version), was 10
1      warning  dropped    -          OidcProvider         -                    warning: x:OidcProvider anonymousClientRegistration: dropped (no equivalent in the target version), was false
1      warning  dropped    -          OidcProvider         -                    warning: x:OidcProvider requireClientRegistration: dropped (no equivalent in the target version), was false
1      warning  dropped    -          OidcProvider         -                    warning: x:OidcProvider authCodeMaxAttempts: dropped (no equivalent in the target version), was 3
1      warning  dropped    -          OidcProvider         -                    warning: x:OidcProvider refreshTokenRenewal: dropped (no equivalent in the target version), was 345600000
1      warning  dropped    -          Role                 1                    warning: x:Role/b enabledPermissions/jmapPrincipalCreate: dropped (no equivalent in the target version)
1      warning  dropped    -          Role                 1                    warning: x:Role/b enabledPermissions/jmapPrincipalDestroy: dropped (no equivalent in the target version)
1      warning  dropped    -          Role                 1                    warning: x:Role/b enabledPermissions/jmapPrincipalUpdate: dropped (no equivalent in the target version)
1      warning  dropped    -          Role                 1                    warning: x:Role/b enabledPermissions/sysArchivedItemCreate: dropped (no equivalent in the target version)
1      warning  dropped    -          Role                 1                    warning: x:Role/b enabledPermissions/sysSpamTrainingSampleUpdate: dropped (no equivalent in the target version)
1      warning  dropped    -          Role                 2                    warning: x:Role/c enabledPermissions/jmapPrincipalCreate: dropped (no equivalent in the target version)
1      warning  dropped    -          Role                 2                    warning: x:Role/c enabledPermissions/jmapPrincipalDestroy: dropped (no equivalent in the target version)
1      warning  dropped    -          Role                 2                    warning: x:Role/c enabledPermissions/jmapPrincipalUpdate: dropped (no equivalent in the target version)
1      warning  dropped    -          Role                 2                    warning: x:Role/c enabledPermissions/sysArchivedItemCreate: dropped (no equivalent in the target version)
1      warning  dropped    -          Role                 2                    warning: x:Role/c enabledPermissions/sysSpamTrainingSampleUpdate: dropped (no equivalent in the target version)
1      warning  dropped    -          Role                 3                    warning: x:Role/d enabledPermissions/sysQueuedMessageCreate: dropped (no equivalent in the target version)
1      warning  dropped    -          Role                 4                    warning: x:Role/e enabledPermissions/oAuthClientOverride: dropped (no equivalent in the target version)
1      warning  dropped    -          Role                 4                    warning: x:Role/e enabledPermissions/oAuthClientRegistration: dropped (no equivalent in the target version)
1      warning  dropped    -          Role                 4                    warning: x:Role/e enabledPermissions/sysActionDestroy: dropped (no equivalent in the target version)
1      warning  dropped    -          Role                 4                    warning: x:Role/e enabledPermissions/sysActionGet: dropped (no equivalent in the target version)
1      warning  dropped    -          Role                 4                    warning: x:Role/e enabledPermissions/sysActionQuery: dropped (no equivalent in the target version)
1      warning  dropped    -          Role                 4                    warning: x:Role/e enabledPermissions/sysActionUpdate: dropped (no equivalent in the target version)
1      warning  dropped    -          Role                 4                    warning: x:Role/e enabledPermissions/sysArchivedItemCreate: dropped (no equivalent in the target version)
1      warning  dropped    -          Role                 4                    warning: x:Role/e enabledPermissions/sysArfExternalReportCreate: dropped (no equivalent in the target version)
1      warning  dropped    -          Role                 4                    warning: x:Role/e enabledPermissions/sysArfExternalReportUpdate: dropped (no equivalent in the target version)
1      warning  dropped    -          Role                 4                    warning: x:Role/e enabledPermissions/sysClusterNodeCreate: dropped (no equivalent in the target version)
1      warning  dropped    -          Role                 4                    warning: x:Role/e enabledPermissions/sysClusterNodeDestroy: dropped (no equivalent in the target version)
1      warning  dropped    -          Role                 4                    warning: x:Role/e enabledPermissions/sysClusterNodeUpdate: dropped (no equivalent in the target version)
1      warning  dropped    -          Role                 4                    warning: x:Role/e enabledPermissions/sysDmarcExternalReportCreate: dropped (no equivalent in the target version)
1      warning  dropped    -          Role                 4                    warning: x:Role/e enabledPermissions/sysDmarcExternalReportUpdate: dropped (no equivalent in the target version)
1      warning  dropped    -          Role                 4                    warning: x:Role/e enabledPermissions/sysDmarcInternalReportCreate: dropped (no equivalent in the target version)
1      warning  dropped    -          Role                 4                    warning: x:Role/e enabledPermissions/sysLogCreate: dropped (no equivalent in the target version)
1      warning  dropped    -          Role                 4                    warning: x:Role/e enabledPermissions/sysLogDestroy: dropped (no equivalent in the target version)
1      warning  dropped    -          Role                 4                    warning: x:Role/e enabledPermissions/sysLogUpdate: dropped (no equivalent in the target version)
1      warning  dropped    -          Role                 4                    warning: x:Role/e enabledPermissions/sysMetricCreate: dropped (no equivalent in the target version)
1      warning  dropped    -          Role                 4                    warning: x:Role/e enabledPermissions/sysMetricDestroy: dropped (no equivalent in the target version)
1      warning  dropped    -          Role                 4                    warning: x:Role/e enabledPermissions/sysMetricUpdate: dropped (no equivalent in the target version)
1      warning  dropped    -          Role                 4                    warning: x:Role/e enabledPermissions/sysQueuedMessageCreate: dropped (no equivalent in the target version)
1      warning  dropped    -          Role                 4                    warning: x:Role/e enabledPermissions/sysSpamTrainingSampleUpdate: dropped (no equivalent in the target version)
1      warning  dropped    -          Role                 4                    warning: x:Role/e enabledPermissions/sysTlsExternalReportCreate: dropped (no equivalent in the target version)
1      warning  dropped    -          Role                 4                    warning: x:Role/e enabledPermissions/sysTlsExternalReportUpdate: dropped (no equivalent in the target version)
1      warning  dropped    -          Role                 4                    warning: x:Role/e enabledPermissions/sysTlsInternalReportCreate: dropped (no equivalent in the target version)
1      warning  dropped    -          Role                 4                    warning: x:Role/e enabledPermissions/sysTraceCreate: dropped (no equivalent in the target version)
1      warning  dropped    -          Role                 4                    warning: x:Role/e enabledPermissions/sysTraceDestroy: dropped (no equivalent in the target version)
1      warning  dropped    -          Role                 4                    warning: x:Role/e enabledPermissions/sysTraceUpdate: dropped (no equivalent in the target version)
1      warning  dropped    -          Role                 4                    warning: x:Role/e enabledPermissions/taskIndexDocument: dropped (no equivalent in the target version)
1      warning  dropped    -          Role                 4                    warning: x:Role/e enabledPermissions/taskIndexTrace: dropped (no equivalent in the target version)
1      warning  dropped    -          Role                 4                    warning: x:Role/e enabledPermissions/taskUnindexDocument: dropped (no equivalent in the target version)
1      warning  dropped    -          SpamTag              307011838198017536   warning: x:SpamTag/iqvzups7d9qa: dropped (no equivalent in the target version), was {"@type":"Score","score":3.0,"tag":"LLM_COMMERCIAL_HIGH"}
1      warning  dropped    -          SpamTag              307011838198018048   warning: x:SpamTag/iqvzups7d2aa: dropped (no equivalent in the target version), was {"@type":"Score","score":0.5,"tag":"LLM_COMMERCIAL_LOW"}
1      warning  dropped    -          SpamTag              307011838198018560   warning: x:SpamTag/iqvzups7d2qa: dropped (no equivalent in the target version), was {"@type":"Score","score":2.0,"tag":"LLM_COMMERCIAL_MEDIUM"}
1      warning  dropped    -          SpamTag              307011838198019072   warning: x:SpamTag/iqvzups7d0aa: dropped (no equivalent in the target version), was {"@type":"Score","score":3.0,"tag":"LLM_HARMFUL_HIGH"}
1      warning  dropped    -          SpamTag              307011838198019584   warning: x:SpamTag/iqvzups7d0qa: dropped (no equivalent in the target version), was {"@type":"Score","score":0.5,"tag":"LLM_HARMFUL_LOW"}
1      warning  dropped    -          SpamTag              307011838200117248   warning: x:SpamTag/iqvzups2d1aa: dropped (no equivalent in the target version), was {"@type":"Score","score":2.0,"tag":"LLM_HARMFUL_MEDIUM"}
1      warning  dropped    -          SpamTag              307011838200117760   warning: x:SpamTag/iqvzups2d1qa: dropped (no equivalent in the target version), was {"@type":"Score","score":-3.0,"tag":"LLM_LEGITIMATE_HIGH"}
1      warning  dropped    -          SpamTag              307011838200118272   warning: x:SpamTag/iqvzups2d3aa: dropped (no equivalent in the target version), was {"@type":"Score","score":-0.5,"tag":"LLM_LEGITIMATE_LOW"}
1      warning  dropped    -          SpamTag              307011838200118784   warning: x:SpamTag/iqvzups2d3qa: dropped (no equivalent in the target version), was {"@type":"Score","score":-2.0,"tag":"LLM_LEGITIMATE_MEDIUM"}
1      warning  dropped    -          SpamTag              307011838200119296   warning: x:SpamTag/iqvzups2eaaa: dropped (no equivalent in the target version), was {"@type":"Score","score":3.0,"tag":"LLM_UNSOLICITED_HIGH"}
1      warning  dropped    -          SpamTag              307011838200119808   warning: x:SpamTag/iqvzups2eaqa: dropped (no equivalent in the target version), was {"@type":"Score","score":0.5,"tag":"LLM_UNSOLICITED_LOW"}
1      warning  dropped    -          SpamTag              307011838200120320   warning: x:SpamTag/iqvzups2ebaa: dropped (no equivalent in the target version), was {"@type":"Score","score":2.0,"tag":"LLM_UNSOLICITED_MEDIUM"}
1      warning  dropped    -          SystemSettings       -                    warning: x:SystemSettings threadPoolSize: dropped (no equivalent in the target version)
1      info     dropped    -          Certificate          320803050477402624   expired at 2026-10-26T14:01:42Z; Stalwart deletes expired Certificate objects when it starts
83 rows

(skipped some lines with DmarcExternalReport warnings.

$ stalwart-migrate report --category skipped  --state /opt/stalwart-mail/migrate
run    severity category   account    object               id                   message
0 rows

Hi ComSubVie,

Your domains are all there; the 14 DKIM signatures are in a different tenant than their domains (one of them has a tenant and the other doesn’t, or they have different ones). 0.16 allowed that, but 1.0 requires a DKIM key to be in the same tenant as its domain and refuses to write it otherwise. The tool you ran reports that refusal as Invalid foreign key: Domain with id ..., which is misleading; stalwart-migrate 1.0.6 says ... is not in the same tenant as this object.

The tool should have caught this at prepare. That’s fixed for the next stalwart-migrate release, where prepare stops with an error naming each signature, its domain and both tenants.

To get past it now, give the signatures their domain’s tenant in 0.16, or clear the tenant on both, then repeat the run with the same --state. The run picks up the changed objects, so there’s no need to start over.

Thanks. I migrated with --allow-errors, it seems to work fine. I’m not missing any domains.