Defect #42578
openCreating scope :system. Overwriting existing method Enumeration.system warning when using the rake redmine:email:receive_imap command
0%
Description
Hello,
We are using the rake redmine:email:receive_imap
command in a cron job to fetch specific mails and create a Redmine issue with them. Since updating Redmine to version 5.1.7, we have noticed that this command is creating a lot of warning messages, causing our logs to fill up.
The following warning message appears every time the cron job is executed.
Warning message: W, [2025-04-14T06:40:05.974486 #3729] WARN -- : Creating scope :system. Overwriting existing method Enumeration.system.
When there are emails to fetch, the command does fetch them and creates a new Redmine issue but also always adds the above warning message.
Rake Command:
bundle exec rake -f /usr/src/redmine/Rakefile redmine:email:receive_imap RAILS_ENV=production host=$host port=993 ssl=1 username=$user password=$psw folder="myFolder" move_on_success="myFolder" unknown_user=accept no_permission_check=1 project="one2editfs-feedback" tracker=Protocol
I tried doing my own research as well as searching on the internet for this warning message but was unable to find a description or solution to "fix" this. I also thought that since the command creates the Redmine issues despite the warning message, if it was possible to maybe lower the log level somewhere, would this be feasible or would this just hide something that needs fixing?
These are our system infos:
Environment: Redmine version 5.1.7.stable Ruby version 3.2.7-p253 (2025-02-04) [x86_64-linux] Rails version 6.1.7.10
Any help is appreciated. Thank you in advance
Updated by Rolf Wojtech 14 days ago
I observe the same issue, just with multiple lines:
W, [2025-05-08T11:00:05.921821 #1190502] WARN -- : Creating scope :sorted. Overwriting existing method User.sorted. W, [2025-05-08T11:00:05.922450 #1190502] WARN -- : Creating scope :having_mail. Overwriting existing method User.having_mail. W, [2025-05-08T11:00:06.094592 #1190502] WARN -- : Creating scope :sorted. Overwriting existing method Group.sorted. W, [2025-05-08T11:00:06.163791 #1190502] WARN -- : Creating scope :system. Overwriting existing method Enumeration.system.
I think it stems from something the plugins do to patch things, so the exact log message might vary depending on the used plugins.
redmine_contacts/patches/compatibility$ grep -rn "scope" . ./user_patch.rb:26: scope :having_mail, lambda {|arg|
The question is if this is something the plugin developers should fix. For patch, this seems like intended behaviour. redmine_contacts is up to date (4.4.2)
Environment: Redmine version 5.0.12.stable Ruby version 3.1.2-p20 (2022-04-12) [x86_64-linux-gnu] Rails version 6.1.7.10 Environment production Database adapter Mysql2 Mailer queue ActiveJob::QueueAdapters::AsyncAdapter Mailer delivery smtp Redmine settings: Redmine theme Boostmine (includes JavaScript)