Using Safe Mode to troubleshoot issues with themes and plugins

:bookmark: This guide explains how to use Discourse’s Safe Mode to troubleshoot issues with themes and plugins.

:person_raising_hand: Required user level: All users

Discourse offers a “JavaScript Safe Mode” that allows any user to isolate the root cause of JavaScript issues caused by plugins, themes, or theme components. This feature is particularly useful for troubleshooting problems on your Discourse site.

Accessing Safe Mode

To access Safe Mode, follow these steps:

  1. Open a new browser tab.

  2. Enter the following URL in the address bar, replacing [your-site-name](http://discourse.example.com) with your actual Discourse site domain:

    http://discourse.example.com/safe-mode
    

    For example, the Safe Mode URL for the Discourse demo site is:
    https://try.discourse.org/safe-mode

  3. Click the ‘Enter Safe Mode’ button:

Safe Mode options

When entering Safe Mode, you can select from the following options:

  • Disable themes and theme components
  • Disable unofficial client-side plugin customizations
  • Disable all client-side plugin customizations
  • Make Javascript deprecations raise an error

By default, the first three options are selected. The deprecation errors option is unchecked by default, and is primarily useful for plugin and theme developers testing compatibility with upcoming Discourse updates. You can enter Safe Mode multiple times with different combinations to isolate the specific component causing issues on your site.

Using Safe Mode

  1. Select the desired options on the Safe Mode page.
  2. Click “Enter Safe Mode” to apply your selections.
  3. You will see a banner indicating that Safe Mode is enabled.
  4. Browse your site to check if the issue persists with the selected components disabled.

Exiting Safe Mode

To exit Safe Mode, simply close your browser tab.

Important notes

When sharing a Safe Mode link for your site, be aware that it needs to be opened in a new tab or added directly to the address bar; otherwise, it may not work correctly.

:warning: Safe Mode currently only disables the JavaScript portions of plugins. To disable the server-side portion of a plugin, you must rebuild your container with the plugin commented out.

Troubleshooting

If you cannot load the initial Safe Mode selection page, try visiting the following URL, which will skip the page and load Safe Mode directly:

https://discourse.example.com/?safe_mode=no_themes,no_plugins

For example: https://try.discourse.org/?safe_mode=no_themes,no_plugins

The available safe_mode query parameter values are: no_themes, no_unofficial_plugins, no_plugins, and deprecation_errors. These can be combined with commas.

Last edited by @hugh 2024-07-30T05:32:08Z

Check documentPerform check on document:
73 Likes
Admin Plugin page is blank - Error: There is no route named adminPlugins.index
502 and then empty forum after `./launcher rebuild app`
Upgraded last night and login button no longer works
Content of messages not showing up
"About" pages crashing our Discourse
Topic Preview Broken (due to Google PageSpeed Module)
Uncaught Errors
Manually Clear DistributedCache
Browser too old message when "compatibility mode" is forced in IE 11
Admin Plugin page is blank - Error: There is no route named adminPlugins.index
My site just broke after restarting server
After Recent Upgrade to 1.08? beta - No forum shows
Blank topics after import?
Problems clicking topic links in IE11
Website looks different on different browsers
How to disable a component without access to site?
Cannot create new topics (already disabled plugins)
How to increase site speed
Disable plugins without restarting?
A "safe mode" to easily disable all third party plugins
Beginner's guide to using Discourse Themes
Global notice doesn’t show
Incorrect initial order when user sorts topic list
Unable to expand profile
Disable plugin without downtime?
Mobile Header expanding after tapping hamburger menu
Discourse 2.3.0.beta10 Release Notes
Lightbox not showing up on uploaded images after update
Vimeo onebox not working
Pasting tables from spreadsheets no longer working after 2.3 upgrade
Contains_dtoc in Grey Amber theme header
Site fails to load with js errors
No content displayed on front category page after upgrade
Notifications are acting strange
Occasional page loads with no post content due to plugins
Discourse 2.5.0.beta2 Release Notes
LDAP Setup for Discourse
Unable to add/edit tags
Category unlike any other category
Unable to save wiki update
Infinite scroll not working in "Latest" on Mobile
Disappearing posts in 2.1.0.beta2
Post content not showing up
In-post links to topics - no longer update to the initial posts title
Issue with menu, admin
Excerpts truncating at 50 characters
How to change default Discourse theme via CLI?
Mentions reported wrongly as replies in notifications list
Bad JS customizations - how to fix in the backend?
Send Invites button should not be visible if local logins are disabled
Topic-footer buttons are disappearing
Blank pages, 500 errors and no logs
[2.1.0b6] New topic button is moving behind burger on click
Google, Twitter and Facebook Logins not working due to ad blocker
Can't See Posts When Logged Out
After latest admin/upgrade my Admin dashboard won't load
My install was broken because I upgraded but did not upgrade plugins
Bulk edit icon not showing?
Quoting is not working anymore
Some user see a blank page when opening a topic
Admin Trouble Creating a Category
Browser Back Button issue
Topic mismatch troubleshooting
Edit icon not activating after edits
I don't see the staff wrench on posts
Forum does not work for users on iOS
Category autocomplete stopped working on our site?
UI not loading after git pull update
Gui for querying category of solved or unsolved topics
Image displayed incorrectly on Mobile due to theme settings
Preview of post not loading because force https was not set
Reordering Categories Produces Error 422
Limit on Number of Child Categories?
Issue in user summary
Lightbox for images comes by default?
Having an issue with images' width getting cut off on desktop
Issue with the page title in Arabic?
Latest update broke my forum
Registration modal/popup not showing up for private instance
Iframes Not Working
Discourse unresponsive in Chrome
Topics tagged with `info` have strange appearance
Logins redirects to missing notifications page
Discourse broken after upgrade
Topic Will Close A Few Seconds After The Last Reply
Issues with index page infinite scrolling?
How might we better structure #howto?
Hashtags with numbers in parentheses appearing everywhere on Discourse site
After updating to 2.8.0.beta8, nothing shows as "read" anymore
Breaking Mobile view check after Discourse update to 2.5.0.beta7
Dashboard empty since upgradeto 2.5.0
Can’t create new category
Login form missing entirely from Discourse instance
Blank website after update
Content won't load after update
Category link failed after updating today
Error 500 on category page and homepage after upgrade to 2.6
Mouse click is not working in my forum after recent update
Screen black out bug on modal
Social share components do not appear
Admin panel does not work
Totally blank upgrades page
Accidentally overwrote application.hbs || Enter safe mode
Latest beta update (2.7.0b7) gone wrong
Some topic category boxes are missing
Need help reverting forums. I made a mistake
Pups::ExecError: su postgres -c 'psql discourse -c "alter schema public owner to discourse;"' failed with return
Can not access Discourse - blank page
Site broken after update
The "Save Changes" button is very low on my user preferences interface page
Phantom signups (two users with the same account after migration)
Homepage (sub)category display - lots of whitespace
Category Image Formatting
Update problem help pls
Bug on topic interface after an update || Resolved
Scroll jank when scrolling up
504 Gateway Timeout for some reports
Trust level 1 users cannot Invite
Error: Something went wrong - "Error while processing route: discovery.categories"
Loading groups gives internal server error
UI not rendering in Chrome/Firefox due to CloudFlare rocket loader
Private Message Can't Be Reached with private messaging disabled
How many category moderators are shown on about page?
What on earth is causing this?
While loading a new component on the site, the site is down
IP Lookup UI is broken
My forum is stuck on the loading screen
Safe-mode failed with a plugin
After upgrading to discourse 3.. can only access to admin using safe-mode
BBCode `url` tags break if wrapped text ends in URL with component after host
Fedoras Discourse instance made some troubles. Could the support please give some feedback
Minimizing Maintenance on Theme Customizations
Hide topic timeline
Forum stuck on the loading home screen
MacOs users on old version can´t read posts
Easy Responsive Footer Plug-in bug issues
Inline formatting used when "preformatted text" formatting applied to multi-line selection
Moving the server
Entire site is a blank page after upgrade
Collapse Button Not Working on Profile Page (Mobile)
Discourse forum wont load any pages whatsoever
`white-space` CSS property of clipboard data not respected when pasting in rich text editor
Discourse broken after moving servers
Dragging highlighted texts causes Chrome freeze
Client-side vs. server-side?
Client-side vs. server-side?
While loading a new component on the site, the site is down
Can't get Ruby to update so ./launcher rebuild app keeps failing
Base_path not being substituted in some cases
Edit CSS/HTML of custom theme not appearing
Finding Discourse RSS feeds
500 Error when posting, moment.tz runtime error
Some DMs are not visible
Air Theme Latest Update - Crash
Dashboard New Posts statistics broken
Made some changes I cannot revert
Floating search box cannot be closed when device goes from horizontal to vertical
I'm getting errors when I switch categories too quickly
Inline “preformatted text” formatting used when multi-line selection doesn't contain hard break
Coincidental Markdown in formatted content pasted to rich text editor rendered on publish
Category settings broken
Spurious notification when navigating away from review queue after adding note
Links produced by the Composer link modal break when they contain a ' (%27)
TypeError when submitting a flag with custom content (require_message flags)
OpenClaw plugin for Discourse integration
Case study of an amateur plugin author
500 error on category view mobile due to knowledge base plugin
A topic doesn't open with recent upgrade due to a plugin
Only loading HEAD after upgrading docker, due to Babble plugin
Category Icons
Server errors in 2.5.0.beta3
Weird Formatting Bug in old Microsoft Edge
Topic replies are not displaying in chronological order?
My Discourse site is not loading due to misconfigured CSP
Missing scroll bar slider, in Finnish Localization
Category link failed after updating today
Discourse and Uncaught ReferenceError: ClipboardJS is not defined
The order of characters when typing in the floating search widget is reversed
Using Cloudflare for HTTPS, empty preview pane in edit page
Writing an effective bug report
Avatar settings not visible with SSO
Emoticon button not working anymore (because of babble plugin)
Stable broken due to discourse-spoiler-alert
How to disable a plugin when admin plugin page is not loading
New topic and reply not working
Front page of discourse missing content
Messaging drop down menu not working
The composer needs to be more friendly to iPad Mini

Somehow, for me those links only work when I open them in a new tab or window. The first one leads to the oops page and the second one to the homepage. But the safe-mode banner does not appear. The second one can lead to problems when you send a link to a user to let them try safe-mode. If they just click the link, they will still use the site without safe-mode.

Maybe this information should be added to the how-to.

4 Likes

Good catch -both links are borked. The first needs a ? and the second needs a comma instead of %2C

2 Likes

Where does it need a “?”?
Could you share the link as an example?

1 Like

Oh, sorry, it looks like I’m wrong on the first one: the internal navigation fails, but for a new window it works.
Discourse Meta

And I’m wrong on the other one too! Discourse Meta - The Official Support Forum for Discourse
doesn’t work as a same-page navigation.

My mistake: something is broken, but it’s not the URLs.

1 Like

I think it’s because it’s trying to open them in place. Rather than argue with it I’ve swopped them out for try.discourse.org. :slight_smile:

2 Likes

I think somehow admins should still be informed that sharing those links can easily be a problem.

For example, I report an issue on meta. You could ask, “Could you try https://meta.discourse.org/safe-mode?” Then I would tell you that the link does not work.
Or even worse: you want to specify that I disable only themes, so you ask me to try https://meta.discourse.org/?safe_mode=no_themes. My problem still exists. How are you sure I really used safe-mode? As a user, I think it worked because something happened when I clicked the link.

After I posted here, you know about this. But how do other admins know they have to pay attention that this could be a problem?

3 Likes

I’m wondering, due to the nature of this safe home page displayed (that replaces all the content), if an exception should be made to open this link to a new tab.

2 Likes

I’ve added a note and also a screenshot of a ‘successful’ one. How does that look?

4 Likes

3 posts were split to a new topic: Should safe mode be default off for non-staff users?