plotly/plotly.js · error · Error

No argument passed to Plotly.register.

Error message

No argument passed to Plotly.register.

What it means

Guard at the top of Plotly.register: the function expects one module or a non-empty array of partial-bundle modules to add to the registries (traces, transforms, components, locales, apiMethods). The throw fires when register is called with no argument at all (undefined/null), which would otherwise cause a TypeError inside the module loop.

Source

Thrown at src/registry.js:63

 *                          generally the keys should be the literal input strings, but
 *                          if default translations are provided you can use any string as a key.
 *  - format {object} : a `d3.locale` format specifier for this locale
 *                      any omitted keys we'll fall back on en-US.
 *
 *  A valid `moduleType: 'component'` module has fields:
 *  - name {string} : the component name, used it with Register.getComponentMethod()
 *                    to employ component method.
 *
 *  A valid `moduleType: 'apiMethod'` module has fields:
 *  - name {string} : the api method name.
 *  - fn {function} : the api method called with Register.call();
 *
 */
exports.register = function register(_modules) {
    exports.collectableSubplotTypes = null;

    if(!_modules) {
        throw new Error('No argument passed to Plotly.register.');
    } else if(_modules && !Array.isArray(_modules)) {
        _modules = [_modules];
    }

    for(var i = 0; i < _modules.length; i++) {
        var newModule = _modules[i];

        if(!newModule) {
            throw new Error('Invalid module was attempted to be registered!');
        }

        switch(newModule.moduleType) {
            case 'trace':
                registerTraceModule(newModule);
                break;
            case 'component':
                registerComponentModule(newModule);
                break;

View on GitHub (pinned to 1d090e0b5f)

Solutions

  1. Pass the module(s) to register, e.g. Plotly.register([require('plotly.js/lib/scatter3d')]).
  2. Check that the import used to fetch the module actually resolved (a failed require yields undefined).
  3. Register an array of modules when loading several partial-bundle pieces.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/registry.js:63 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of plotly/plotly.js@1d090e0b5f (2026-09-02). Data as JSON: /api/errors/f8ab7a3cd1f82870. Report an issue: GitHub.