Automatic DNS Management for Infomaniak Fails

Issue Description

When Stalwart tries to update the DNS records on Infomaniak (infomaniak.com) automatically, it fails.

Expected Behavior

The DNS Records are updated.

Actual Behavior

The DNS update task fails.

Reproduction Steps

  1. setup automatic dns management with infomaniak
  2. wait for job to fail

Relevant Log Output

Failed to create DNS record for v1-ed25519-20260526._domainkey.dominik-schwaiger.ch.: Failed to create DNS record: API error: BadRequest {“result”:“error”,“error”:{“code”:“choose_dkim_type”,“description”:“Please choose DKIM Type for this operation”}}; Failed to create DNS record for v1-rsa-20260526._domainkey.dominik-schwaiger.ch.: Failed to create DNS record: API error: BadRequest {“result”:“error”,“error”:{“code”:“choose_dkim_type”,“description”:“Please choose DKIM Type for this operation”}}; Failed to create DNS record for _caldavs._tcp.dominik-schwaiger.ch.: Failed to create DNS record: API error: BadRequest {“result”:“error”,“error”:{“code”:“the_structure_of_the_source_field_is_not_valid”,“description”:“The structure of the Source field is not valid”,“context”:{“en”:“The structure of the Source field is not valid \n”,“fr”:“La structure du champs Source est invalide. \n”,“de”:“Die Struktur des Source-Felds ist ung\u00fcltig. \n”,“it”:“La struttura del campo Origine non \u00e8 valida. \n”,“es”:“La estructura del campo Fuente no es v\u00e1lida. \n”}}}; Failed to create DNS record for _carddavs._tcp.dominik-schwaiger.ch.: Failed to create DNS record: API error: BadRequest {“result”:“error”,“error”:{“code”:“the_structure_of_the_source_field_is_not_valid”,“description”:“The structure of the Source field is not valid”,“context”:{“en”:“The structure of the Source field is not valid \n”,“fr”:“La structure du champs Source est invalide. \n”,“de”:“Die Struktur des Source-Felds ist ung\u00fcltig. \n”,“it”:“La struttura del campo Origine non \u00e8 valida. \n”,“es”:“La estructura del campo Fuente no es v\u00e1lida. \n”}}}; Failed to create DNS record for _imaps._tcp.dominik-schwaiger.ch.: Failed to create DNS record: API error: BadRequest {“result”:“error”,“error”:{“code”:“the_structure_of_the_source_field_is_not_valid”,“description”:“The structure of the Source field is not valid”,“context”:{“en”:“The structure of the Source field is not valid \n”,“fr”:“La structure du champs Source est invalide. \n”,“de”:“Die Struktur des Source-Felds ist ung\u00fcltig. \n”,“it”:“La struttura del campo Origine non \u00e8 valida. \n”,“es”:“La estructura del campo Fuente no es v\u00e1lida. \n”}}}; Failed to create DNS record for _jmap._tcp.dominik-schwaiger.ch.: Failed to create DNS record: API error: BadRequest {“result”:“error”,“error”:{“code”:“the_structure_of_the_source_field_is_not_valid”,“description”:“The structure of the Source field is not valid”,“context”:{“en”:“The structure of the Source field is not valid \n”,“fr”:“La structure du champs Source est invalide. \n”,“de”:“Die Struktur des Source-Felds ist ung\u00fcltig. \n”,“it”:“La struttura del campo Origine non \u00e8 valida. \n”,“es”:“La estructura del campo Fuente no es v\u00e1lida. \n”}}}; Failed to create DNS record for _pop3s._tcp.dominik-schwaiger.ch.: Failed to create DNS record: API error: BadRequest {“result”:“error”,“error”:{“code”:“the_structure_of_the_source_field_is_not_valid”,“description”:“The structure of the Source field is not valid”,“context”:{“en”:“The structure of the Source field is not valid \n”,“fr”:“La structure du champs Source est invalide. \n”,“de”:“Die Struktur des Source-Felds ist ung\u00fcltig. \n”,“it”:“La struttura del campo Origine non \u00e8 valida. \n”,“es”:“La estructura del campo Fuente no es v\u00e1lida. \n”}}}; Failed to create DNS record for _submissions._tcp.dominik-schwaiger.ch.: Failed to create DNS record: API error: BadRequest {“result”:“error”,“error”:{“code”:“the_structure_of_the_source_field_is_not_valid”,“description”:“The structure of the Source field is not valid”,“context”:{“en”:“The structure of the Source field is not valid \n”,“fr”:“La structure du champs Source est invalide. \n”,“de”:“Die Struktur des Source-Felds ist ung\u00fcltig. \n”,“it”:“La struttura del campo Origine non \u00e8 valida. \n”,“es”:“La estructura del campo Fuente no es v\u00e1lida. \n”}}}

Stalwart Version

v0.16.x

Installation Method

Docker

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 actual Infomaniak API integration is handled by the dns_update crate (an external dependency), not directly in this file. The errors clearly show two distinct problems from Infomaniak’s API side:

  1. choose_dkim_type - Infomaniak’s API requires a DKIM type parameter to be explicitly specified when creating DKIM TXT records, which the integration is not currently sending.
  2. the_structure_of_the_source_field_is_not_valid - Infomaniak’s API is rejecting the format of SRV records (_caldavs._tcp, _carddavs._tcp, _imaps._tcp, _jmap._tcp, _pop3s._tcp, _submissions._tcp), likely because the source/target field format differs from what Infomaniak expects.

These are bugs in Stalwart’s Infomaniak DNS provider integration (in the underlying dns_update crate). The Infomaniak API has specific requirements that the current implementation does not satisfy:

  • DKIM records need an extra dkim_type parameter
  • SRV records need the source field formatted differently than what is being sent

Unfortunately this is not something you can work around through configuration – it requires a code fix in the Infomaniak provider implementation. As a workaround in the meantime, you can create the DNS records manually in the Infomaniak control panel and disable automatic DNS management, or you can use a different DNS provider for your domain if that’s an option.

A human maintainer will need to review and fix the Infomaniak provider to pass the required dkim_type field for DKIM records and to format SRV record source fields per Infomaniak’s API spec.

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

For future reference, this is a DKIM Post request example:
```json
{
“records”: [
{
“dkim_type”: “TXT”,
“source”: “teststess._domainkey”,
“target”: “looool”,
“ttl”: 3600,
“type”: “DKIM”
}
]
}
```

and this a SRV example:
```json
{
“records”: [
{
“priority”: 10,
“source”: “test”,
“srv_port”: “22”,
“srv_protocol”: “_tcp”,
“srv_weight”: “10”,
“target”: “test.dominik-schwaiger.ch”,
“ttl”: 3600,
“type”: “SRV”
}
]
}
```.

In the SRV record, `_tcp.dominik-schwaiger.ch` is hard-coded / selected.

This will be likely fixed in v0.16.7 after a PR that upgrades the Infomaniak API to v2.