odoo/odoo · error · UserError

This connection has been superseded by another database. Reg

Error message

This connection has been superseded by another database. Register again.

What it means

Raised in _mark_connection_out_of_sync's follow-up server call: after detecting desync, Odoo calls /api/peppol/1/mark_connection_out_of_sync with token_desync_counter; if the proxy replies code 'connection_superseded', it means another database already resynced and took over the connection. Odoo then calls _peppol_out_of_sync_disconnect_this_database(), commits, and raises this UserError telling the user to register again.

Source

Thrown at addons/account_peppol/models/account_edi_proxy_user.py:131

        if self.is_token_out_of_sync:
            return
        self.sudo().write({
            'is_token_out_of_sync': True,
            'refresh_token': None,
        })
        self.env.cr.flush()  # if token refreshed & commited in another transaction, crash before doing API call
        try:
            self._make_request(
                f'{self._get_server_url()}/api/peppol/1/mark_connection_out_of_sync',
                params={'token_desync_counter': self.token_sync_version},
                auth_type='asymmetric'
            )
        except AccountEdiProxyError as e:
            if e.code == 'connection_superseded':
                self._peppol_out_of_sync_disconnect_this_database()
                if not tools.config['test_enable'] and not modules.module.current_test:
                    self.env.cr.commit()
                raise UserError(_('This connection has been superseded by another database. Register again.'))
            raise

    def _peppol_out_of_sync_reconnect_this_database(self):
        self.ensure_one()
        assert self.is_token_out_of_sync
        self.token_sync_version += 1
        response = self._make_request(
            f'{self._get_server_url()}/api/peppol/1/resync_connection',
            params={'token_desync_counter': self.token_sync_version},
            auth_type='asymmetric'
        )
        if response.get('error'):
            if response['error'].get('code') == 'connection_superseded':
                self._peppol_out_of_sync_disconnect_this_database()
                if not tools.config['test_enable'] and not modules.module.current_test:
                    self.env.cr.commit()
            raise AccountEdiProxyError(
                response['error'].get('code', 'unknown_error'),

View on GitHub (pinned to 1e661df964)

Solutions

  1. Decide which database should own the participant; on the losing database, start a fresh registration (Settings > Accounting > Peppol Settings > register) as the message instructs.
  2. On the superseding (winning) database, use 'Reconnect this database' to finish resync.
  3. Permanently disable Peppol crons and archive proxy users on the losing copy so it never races again.
  4. If the takeover was accidental, deregister from the winning database and re-register on the correct one.
Defensive patterns

Strategy: fallback

Prevention

When it happens

Trigger: Two databases both in 'out of sync' state race to reconnect: the loser's mark_connection_out_of_sync call returns 'connection_superseded' because the winner already bumped the sync counter. Happens right after a database duplication where both copies attempt to use or repair the same Peppol connection.

Common situations: Production and a cloned staging database both flagged out of sync; a company migrated to a new Odoo instance while the old instance still had Peppol crons enabled; migration-key handover done from the wrong database.

Related errors


AI-assisted analysis of odoo/odoo@1e661df964 (2026-08-15). Data as JSON: /api/errors/a151f332814477a9. Report an issue: GitHub.