plotly/plotly.js · error · Error

Component module *name* must be a string.

Error message

Component module *name* must be a string.

What it means

Guard in registerComponentModule (called from Plotly.register for modules with moduleType 'component'). A component module must carry a string name, because that name is the key under which the module is stored in componentsRegistry and is how relayout array handling resolves component methods (via Register.getComponentMethod). The throw fires when a registered component module has a missing or non-string name field.

Source

Thrown at src/registry.js:252

        return;
    }

    // relayout array handling will look for component module methods with this
    // name and won't find them because this is a subplot module... but that
    // should be fine, it will just fall back on redrawing the plot.
    findArrayRegexps(_module);

    // not sure what's best for the 'cartesian' type at this point
    exports.subplotsRegistry[plotType] = _module;

    for(var componentName in exports.componentsRegistry) {
        mergeComponentAttrsToSubplot(componentName, _module.name);
    }
}

function registerComponentModule(_module) {
    if(typeof _module.name !== 'string') {
        throw new Error('Component module *name* must be a string.');
    }

    var name = _module.name;
    exports.componentsRegistry[name] = _module;

    if(_module.layoutAttributes) {
        if(_module.layoutAttributes._isLinkedToArray) {
            pushUnique(exports.layoutArrayContainers, name);
        }
        findArrayRegexps(_module);
    }

    for(var traceType in exports.modules) {
        mergeComponentAttrsToTrace(name, traceType);
    }

    for(var subplotName in exports.subplotsRegistry) {
        mergeComponentAttrsToSubplot(name, subplotName);

View on GitHub (pinned to 1d090e0b5f)

Solutions

  1. Add a string name field to the component module, e.g. {moduleType:'component', name:'rangeSlider', ...}.
  2. Check for typos such as moduleName instead of name.
  3. Verify the module object passed to Plotly.register matches the documented component module schema.
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at src/registry.js:252 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/7e247661f06a4d68. Report an issue: GitHub.