{"record":{"id":"833d4a409a9701ed","repo":"apache/echarts","slug":"only-one-bmap-component-can-exist","errorCode":null,"errorMessage":"Only one bmap component can exist","messagePattern":"Only one bmap component can exist","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"extension-src/bmap/BMapCoordSys.ts","lineNumber":279,"sourceCode":"    Overlay.prototype.draw = function () {};\n\n    return Overlay as BMapECExtendedOverlayCtor;\n}\n\nBMapCoordSys.create = function (ecModel, api) {\n    let bmapCoordSys: BMapCoordSys;\n    const root = api.getDom();\n\n    // TODO Dispose\n    ecModel.eachComponent(COMPONENT_MAIN_TYPE_BMAP, function (bmapModel: BMapModel) {\n        const painter = api.getZr().painter;\n        const viewportRoot = painter.getViewportRoot();\n        if (typeof BMap === 'undefined') {\n            throw new Error('BMap api is not loaded');\n        }\n        Overlay = Overlay || createOverlayCtor();\n        if (bmapCoordSys) {\n            throw new Error('Only one bmap component can exist');\n        }\n        let bmap;\n        if (!bmapModel.__bmap) {\n            // Not support IE8\n            let bmapRoot: HTMLElement = root.querySelector('.ec-extension-bmap');\n            if (bmapRoot) {\n                // Reset viewport left and top, which will be changed\n                // in moving handler in BMapView\n                viewportRoot.style.left = '0px';\n                viewportRoot.style.top = '0px';\n                root.removeChild(bmapRoot);\n            }\n            bmapRoot = document.createElement('div');\n            bmapRoot.className = 'ec-extension-bmap';\n            // fix #13424\n            bmapRoot.style.cssText = 'position:absolute;width:100%;height:100%';\n            root.appendChild(bmapRoot);\n","sourceCodeStart":261,"sourceCodeEnd":297,"githubUrl":"https://github.com/apache/echarts/blob/30076aedcd7b7f65d8dd8e8d9ece46ce778133a3/extension-src/bmap/BMapCoordSys.ts#L261-L297","documentation":"Thrown inside the eachComponent loop in BMapCoordSys.create: each ECharts instance may own at most one bmap coordinate-system component. The loop assigns bmapCoordSys on the first matched bmap component and throws on a second match, so any duplicate bmap entry triggers the error on the second iteration. NOT guarded by __DEV__ — it throws in production.","triggerScenarios":"An option object that resolves to more than one bmap component: e.g. merging two option objects that each declare a bmap key without notMerge, or passing an array with two bmap entries.","commonSituations":"Calling setOption a second time to add a bmap when one already exists (merge mode); copy-pasting bmap config into an existing bmap chart; composing base + overlay options that both carry bmap.","solutions":["Keep exactly one bmap component per chart instance","If you need two maps, instantiate a second ECharts instance in a separate DOM container","When merging options, ensure the merged result has a single bmap key (use notMerge:true to replace)"],"exampleFix":"// before\nchart.setOption({ bmap: {...} });\nchart.setOption({ bmap: {...}, series: [...] }); // merge -> two bmap components\n\n// after\nchart.setOption({ bmap: {...}, series: [...] }, true); // notMerge replaces","handlingStrategy":"validation","validationCode":"const bmaps = Array.isArray(option.bmap) ? option.bmap : (option.bmap ? [option.bmap] : []);\nif (bmaps.length > 1) {\n  console.error('[bmap] only one bmap component allowed; trimming');\n  option.bmap = bmaps[0];\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat bmap as a singleton per chart instance","Use notMerge:true when replacing the bmap component","Use a second ECharts instance for a second map"],"tags":["bmap-extension","configuration","single-instance","runtime"],"backgroundTag":null,"analyzedSha":"30076aedcd7b7f65d8dd8e8d9ece46ce778133a3","analyzedAt":"2026-08-12T12:42:28.134Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}