{"record":{"id":"ec5db2eeba2da667","repo":"plotly/plotly.js","slug":"invalid-module-was-attempted-to-be-registered","errorCode":null,"errorMessage":"Invalid module was attempted to be registered!","messagePattern":"Invalid module was attempted to be registered!","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/registry.js","lineNumber":72,"sourceCode":" *  A valid `moduleType: 'apiMethod'` module has fields:\n *  - name {string} : the api method name.\n *  - fn {function} : the api method called with Register.call();\n *\n */\nexports.register = function register(_modules) {\n    exports.collectableSubplotTypes = null;\n\n    if(!_modules) {\n        throw new Error('No argument passed to Plotly.register.');\n    } else if(_modules && !Array.isArray(_modules)) {\n        _modules = [_modules];\n    }\n\n    for(var i = 0; i < _modules.length; i++) {\n        var newModule = _modules[i];\n\n        if(!newModule) {\n            throw new Error('Invalid module was attempted to be registered!');\n        }\n\n        switch(newModule.moduleType) {\n            case 'trace':\n                registerTraceModule(newModule);\n                break;\n            case 'component':\n                registerComponentModule(newModule);\n                break;\n            case 'locale':\n                registerLocale(newModule);\n                break;\n            case 'apiMethod':\n                var name = newModule.name;\n                exports.apiMethodRegistry[name] = newModule.fn;\n                break;\n            default:\n                throw new Error('Invalid module was attempted to be registered!');","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/plotly/plotly.js/blob/1d090e0b5ffb8d0fdf6e0e4ff51d3f3cf67f1314/src/registry.js#L54-L90","documentation":"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.","triggerScenarios":"Thrown at src/registry.js:72 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"1d090e0b5ffb8d0fdf6e0e4ff51d3f3cf67f1314","analyzedAt":"2026-09-02T22:03:39.906Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T02:17:09.455Z"}