octobercms/october · error · Error

Module namespace is not registered

Error message

Module namespace is not registered: ${namespace}

What it means

OctoberModuleRegistry.import throws when the requested namespace was never passed to register() (or registration happens after the import attempt). It is a fail-fast guard against using an unregistered backend JS module namespace.

Solutions

  1. Ensure the module's JS file is loaded and calls register() before import
  2. Check the namespace string for typos/case differences
  3. Verify script load order so registration runs before consumer code
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at modules/backend/assets/js/october/october.jsmodule.js:18 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of octobercms/october@b608633a7e (2026-08-21). Data as JSON: /api/errors/fec452a2649276a9. Report an issue: GitHub.

Appendix: source

Thrown at modules/backend/assets/js/october/october.jsmodule.js:18

+(function($) {
    'use strict';

    function OctoberModuleRegistry() {
        this.moduleMap = new Map();

        this.register = function(namespace, registrationFn) {
            if (this.moduleMap.has(namespace)) {
                console.info('Module namespace is already registered: ' + namespace);
                return;
            }

            this.moduleMap.set(namespace, registrationFn());
        };

        this.import = function(namespace) {
            if (!this.exists(namespace)) {
                throw new Error('Module namespace is not registered: ' + namespace);
            }

            return this.moduleMap.get(namespace);
        };

        this.exists = function(namespace) {
            return this.moduleMap.has(namespace);
        };
    }

    if (!window.oc) {
        window.oc = {};
    }

    window.oc.Modules = new OctoberModuleRegistry();

    // oc.Module and $.oc.module is @deprecated -sg
    window.oc.Module = $.oc.module = window.oc.Modules;

View on GitHub (pinned to b608633a7e)