server-tools icon indicating copy to clipboard operation
server-tools copied to clipboard

[18.0]mail_cleanup: stacktrace when testing locally

Open leemannd opened this issue 1 month ago • 0 comments

Module

mail_cleanup

Describe the bug

The below stacktrace is promted when doing a "Fetch now" on an incoming mail server

RPC_ERROR

Odoo Server Error

Occured on localhost:8888 on model fetchmail.server on 2025-11-04 10:00:24 GMT

Traceback (most recent call last):
  File "/odoo/src/odoo/http.py", line 2144, in _transactioning
    return service_model.retrying(func, env=self.env)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/odoo/src/odoo/service/model.py", line 156, in retrying
    result = func()
             ^^^^^^
  File "/odoo/src/odoo/http.py", line 2111, in _serve_ir_http
    response = self.dispatcher.dispatch(rule.endpoint, args)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/odoo/src/odoo/http.py", line 2359, in dispatch
    result = self.request.registry['ir.http']._dispatch(endpoint)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/odoo/external-src/odoo-cloud-platform/monitoring_prometheus/models/ir_http.py", line 38, in _dispatch
    res = super()._dispatch(endpoint)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/odoo/src/odoo/addons/base/models/ir_http.py", line 333, in _dispatch
    result = endpoint(**request.params)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/odoo/src/odoo/http.py", line 754, in route_wrapper
    result = endpoint(self, *args, **params_ok)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/odoo/src/addons/web/controllers/dataset.py", line 42, in call_button
    action = call_kw(request.env[model], method, args, kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/odoo/src/odoo/api.py", line 535, in call_kw
    result = getattr(recs, name)(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/odoo/external-src/server-tools/mail_cleanup/models/fetchmail_server.py", line 141, in fetch_mail
    imap_server.close()
  File "/usr/local/lib/python3.12/imaplib.py", line 484, in close
    typ, dat = self._simple_command('CLOSE')
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/imaplib.py", line 1239, in _simple_command
    return self._command_complete(name, self._command(name, *args))
                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/imaplib.py", line 977, in _command
    raise self.error("command %s illegal in state %s, "
imaplib.IMAP4.error: command CLOSE illegal in state AUTH, only allowed in states SELECTED

The above server error caused the following client error:
RPC_ERROR: Odoo Server Error
    RPC_ERROR
        at makeErrorFromResponse (http://localhost:8888/web/assets/67c684c/web.assets_web_dark.min.js:3148:163)
        at XMLHttpRequest.<anonymous> (http://localhost:8888/web/assets/67c684c/web.assets_web_dark.min.js:3153:13)

To Reproduce

Affected versions:

Steps to reproduce the behavior:

  1. Setup of mailhog and mailcatcher locally
  2. Create an incoming mail server
  3. Validate the configuration and click on the button Fetch Now

Expected behavior No stacktrace

leemannd avatar Nov 04 '25 10:11 leemannd