Defect #37394


uninitialized constant Redmine::WikiFormatting::CommonMark::HTML (NameError)

Added by Mischa The Evil about 2 years ago. Updated 6 months ago.

Text formatting
Target version:
Start date:
Due date:
% Done:


Estimated time:
Affected version:


There appears to exist a loading issue, probably connected to the Zeitwerk loader, which has now been reported twice in the forums:
1. Error with redmine 5.0.2 on FreeBSD 13.1 amd64 :: Redmine...
2. Help: uninitialized constant Redmine::WikiFormatting::Com...

The exception raised in both the reports is "uninitialized constant Redmine::WikiFormatting::CommonMark::HTML (NameError)".
It gets triggered by source:/tags/5.0.2/lib/redmine/wiki_formatting/common_mark/external_links_filter.rb#L27.

I don't know if this can be reproduced and if so how, but I thought that given that it is the same exception in both the reports, it might be something that has to be investigated and fixed if necessary.

Actions #1

Updated by Azamat Hackimov almost 2 years ago

I think problem is that in Gemfile common_mark group described as optional, but really it can't be disabled, so effectively you have to install all gems for common_mark group in order to launch Redmine 5.

Actions #2

Updated by Joachim Mathes 6 months ago

I can confirm that behavior.

My local development environment works fine. But when I try to run Redmine in a bitnami/ruby container, it fails with a corresponding error regarding a plugin. Even when I remove all plugins Redmine fails with
/lib/redmine/wiki_formatting/markdown/formatter.rb:25:in `<module:Markdown>': uninitialized constant Redmine::WikiFormatting::Markdown::Redcarpet (NameError)                                              

  • the same Redmine version 5.1.1
  • the same Ruby version 3.2.2
  • the same bundler version 2.4.19
  • the same run command bundle exec rails server --environment=development
  • the same Gemfile.lock and thus the same gem versions.
    • e.g. Rails

Any help is appreciated.

Edit (08.01.2024)

I found the error(s) and fixed them. But first of all I would like to share, that running

bundle exec rails zeitwerk:check

helped a lot to check if the error still exists.

Now let's have a look at the fixes
  1. Obviously uninitialized constant Redmine::WikiFormatting::Markdown::Redcarpet (NameError) is related to Markdown. But our Dockerfile excluded markdown:
    BUNDLE_WITHOUT=...:markdown:.... Thus, removing markdown from the exclude list fixed the error.
  2. But I still had another issue with a RedmineUP plugin: redmine_contacts
    NameError: uninitialized constant CalendarsHelper (NameError)
    Did you mean?  CalendarsController
    /app/plugins/redmine_contacts/app/controllers/deals_controller.rb:50:in `<class:DealsController>'

    Well, that one could actually be fixed easily by updating from version 4.3.7 to version 4.3.8. What you must know is, that redmine_contacts is named redmine_crm on RedmineUp's download page.

Also available in: Atom PDF