{"record":{"id":"a151f332814477a9","repo":"odoo/odoo","slug":"this-connection-has-been-superseded-by-another-dat","errorCode":null,"errorMessage":"This connection has been superseded by another database. Register again.","messagePattern":"This connection has been superseded by another database\\. Register again\\.","errorType":"exception","errorClass":"UserError","httpStatus":null,"severity":"error","filePath":"addons/account_peppol/models/account_edi_proxy_user.py","lineNumber":131,"sourceCode":"        if self.is_token_out_of_sync:\n            return\n        self.sudo().write({\n            'is_token_out_of_sync': True,\n            'refresh_token': None,\n        })\n        self.env.cr.flush()  # if token refreshed & commited in another transaction, crash before doing API call\n        try:\n            self._make_request(\n                f'{self._get_server_url()}/api/peppol/1/mark_connection_out_of_sync',\n                params={'token_desync_counter': self.token_sync_version},\n                auth_type='asymmetric'\n            )\n        except AccountEdiProxyError as e:\n            if e.code == 'connection_superseded':\n                self._peppol_out_of_sync_disconnect_this_database()\n                if not tools.config['test_enable'] and not modules.module.current_test:\n                    self.env.cr.commit()\n                raise UserError(_('This connection has been superseded by another database. Register again.'))\n            raise\n\n    def _peppol_out_of_sync_reconnect_this_database(self):\n        self.ensure_one()\n        assert self.is_token_out_of_sync\n        self.token_sync_version += 1\n        response = self._make_request(\n            f'{self._get_server_url()}/api/peppol/1/resync_connection',\n            params={'token_desync_counter': self.token_sync_version},\n            auth_type='asymmetric'\n        )\n        if response.get('error'):\n            if response['error'].get('code') == 'connection_superseded':\n                self._peppol_out_of_sync_disconnect_this_database()\n                if not tools.config['test_enable'] and not modules.module.current_test:\n                    self.env.cr.commit()\n            raise AccountEdiProxyError(\n                response['error'].get('code', 'unknown_error'),","sourceCodeStart":113,"sourceCodeEnd":149,"githubUrl":"https://github.com/odoo/odoo/blob/1e661df964b1b264c9cef3ab28430d4785be3fda/addons/account_peppol/models/account_edi_proxy_user.py#L113-L149","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Decide which database should own the participant; on the losing database, start a fresh registration (Settings > Accounting > Peppol Settings > register) as the message instructs.","On the superseding (winning) database, use 'Reconnect this database' to finish resync.","Permanently disable Peppol crons and archive proxy users on the losing copy so it never races again.","If the takeover was accidental, deregister from the winning database and re-register on the correct one."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only one database may attempt reconnection; disable crons on all copies.","After a supersede, accept a fresh registration rather than retrying reconnect.","Use the migration key when deliberately moving the connection to a new database."],"tags":["peppol","sync","race-condition","database-copy","odoo"],"backgroundTag":null,"analyzedSha":"1e661df964b1b264c9cef3ab28430d4785be3fda","analyzedAt":"2026-08-15T05:22:16.142Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}