plotly/plotly.js · error · Error
Invalid module was attempted to be registered!
Error message
Invalid module was attempted to be registered!
What it means
Per-item guard inside Plotly.register's loop over the modules array. After the argument is normalized to an array, each entry must be a truthy, well-formed module object (with a valid moduleType and matching fields). The throw fires when a falsy entry — usually an undefined slot from a failed import or a sparse array — is encountered, so a broken module is registered instead of silently ignored.
Source
Thrown at src/registry.js:72
* 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;
case 'locale':
registerLocale(newModule);
break;
case 'apiMethod':
var name = newModule.name;
exports.apiMethodRegistry[name] = newModule.fn;
break;
default:
throw new Error('Invalid module was attempted to be registered!');View on GitHub (pinned to 1d090e0b5f)
Solutions
- Check each entry passed to Plotly.register is a module object imported successfully.
- Log the array contents before registering to find the undefined element.
- Verify the module file path/name in the partial bundle import (e.g. plotly.js/lib/scatter) is correct.
- Filter out empty entries before calling register.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at src/registry.js:72 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/ec5db2eeba2da667.
Report an issue: GitHub.