# TypeError: Discourse.\_registerPluginCode is not a function

**URL:** https://meta.discourse.org/t/typeerror-discourse-registerplugincode-is-not-a-function/88572
**Category:** Support
**Created:** [May 28, 2018, 8:06am UTC](https://meta.discourse.org/t/typeerror-discourse-registerplugincode-is-not-a-function/88572 "2018-05-28T08:06:21Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![amotl](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/amotl/32/109873_2.png) [@amotl](https://meta.discourse.org/u/amotl)
#### Post date: [January 13, 2019, 8:28pm UTC](https://meta.discourse.org/t/typeerror-discourse-registerplugincode-is-not-a-function/88572/2 "2019-01-13T20:28:01Z")

</div>

Hi there,

## Background

We are getting the very same error, also on `/u/activate-account`, that’s why we arrived here. Others seem to already have experienced similar errors:

- [Search results for 'Discourse.\_registerPluginCode is not a function' - Discourse Meta](https://meta.discourse.org/search?q=Discourse._registerPluginCode%20is%20not%20a%20function)
- [\_registerPluginCode is not a function](https://meta.discourse.org/t/-registerplugincode-is-not-a-function/55784)
- [Automatic backups are a hit or miss - #3 by itsbhanusharma](https://meta.discourse.org/t/automatic-backups-are-a-hit-or-miss/90181/3)
- [Discourse.\_registerPluginCode should never run code before objects are injected](https://meta.discourse.org/t/discourse--registerplugincode-should-never-run-code-before-objects-are-injected/62808)

## Symptom

When loading `/u/activate-account/<id>`, the browser croaks with this message to the console log:

```javascript
TypeError: Discourse._registerPluginCode is not a function [Learn More] b6099b1e522f132eee5f0b5c866473e5dd008b46.js:7:3
<anonymous>
https://meta.ip-tools.org/theme-javascripts/b6099b1e522f132eee5f0b5c866473e5dd008b46.js:7:3

XML Parsing Error: syntax error report_js_error:1:1
Location: https://meta.ip-tools.org/logs/report_js_error
Line Number 1, Column 1: 

```

When looking at the `Discourse` object, it tells us it’s pretty much empty:  
 ![image](https://global.discourse-cdn.com/meta/original/3X/1/1/112c0c2a7f8607ddf11c10a55843ed99ac385740.png)

```javascript
» Discourse
» > Object { SiteSettings: {} }

```

### At a glance

 ![image](https://global.discourse-cdn.com/meta/original/3X/4/e/4ef100d7524da046d2edcbca693a12940c918f1d.png)

## Reason

We can **reproduce the behavior** with the [Brand Header](https://meta.discourse.org/t/brand-header-theme-component/77977) installed and activated. Without it, everything goes fine.

We can also confirm following the Javascript references that traces (where `Discourse._registerPluginCode` croaks) also lead towards the brand header theme component:

```plaintext
          (function() {
            if ('Em' in window) {
              Ember.TEMPLATES["/connectors/above-site-header/brand-header"] = Ember.HTMLBars.template(...);
            }
          })();
if ('Discourse' in window) {
  Discourse._registerPluginCode('0.8', function (api) {
    var settings = { "brand_name": "The IP Software Community", "website_url": "https://meta.ip-tools.org/", "logo_url": "", "mobile_logo_url": "", "links": "", "icons": "home,http://www.ip-tools.org/|github,https://github.com/ip-tools/" };
[...]

```

## Bummer

At our Discourse instance, this is especially annoying because the account authentication page doesn’t render properly after croaking:

 ![image](https://global.discourse-cdn.com/meta/original/3X/7/7/77256602a147828cb5ba9b804f2ddb98283a22ac.png)

With kind regards,  
Andreas.

---

_[View the full topic](https://meta.discourse.org/t/typeerror-discourse-registerplugincode-is-not-a-function/88572)._
