{"record":{"id":"848377d7c713a2cb","repo":"apache/echarts","slug":"grid-not-found","errorCode":null,"errorMessage":"Grid \"{}\" not found","messagePattern":"Grid \"(.+?)\" not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/coord/cartesian/Grid.ts","lineNumber":576,"sourceCode":"\n            injectCoordSysByOption({\n                targetModel: seriesModel,\n                coordSysType: COORD_SYS_TYPE_CARTESIAN_2D,\n                coordSysProvider: coordSysProvider\n            });\n\n            function coordSysProvider() {\n                const axesModelMap = findAxisModels(seriesModel);\n                const xAxisModel = axesModelMap.xAxisModel;\n                const yAxisModel = axesModelMap.yAxisModel;\n                xAxis = xAxisModel.axis;\n                yAxis = yAxisModel.axis;\n\n                const gridModel = xAxisModel.getCoordSysModel();\n\n                if (__DEV__) {\n                    if (!gridModel) {\n                        throw new Error(\n                            'Grid \"' + retrieve3(\n                                xAxisModel.get('gridIndex'),\n                                xAxisModel.get('gridId'),\n                                0\n                            ) + '\" not found'\n                        );\n                    }\n                    if (xAxisModel.getCoordSysModel() !== yAxisModel.getCoordSysModel()) {\n                        throw new Error('xAxis and yAxis must use the same grid');\n                    }\n                }\n\n                const grid = gridModel.coordinateSystem as Grid;\n\n                return grid.getCartesian(\n                    xAxisModel.componentIndex, yAxisModel.componentIndex\n                );\n            }","sourceCodeStart":558,"sourceCodeEnd":594,"githubUrl":"https://github.com/apache/echarts/blob/30076aedcd7b7f65d8dd8e8d9ece46ce778133a3/src/coord/cartesian/Grid.ts#L558-L594","documentation":"DEV-only guard in Grid.create's coordSysProvider: after resolving xAxisModel/yAxisModel for a cartesian2d series, it looks up the grid model they belong to via getCoordSysModel. If none is found (no grid component registered, or gridIndex/gridId mismatch), it throws with the resolved index/id. Stripped in production.","triggerScenarios":"Modular build without GridComponent registered; series xAxis referencing gridIndex/gridId that points to no grid; grid component omitted from the option.","commonSituations":"Minimal 'echarts/core' build missing GridComponent; gridIndex out of range; gridId typo; relying on default grid that was never created.","solutions":["Register GridComponent on modular builds (echarts.use([GridComponent]))","Ensure a grid component exists, or rely on the implicit default single grid","Match gridIndex/gridId to an existing grid, or drop them"],"exampleFix":"// before (modular, grid not registered)\nimport * as echarts from 'echarts/core';\nimport { BarChart } from 'echarts/charts';\necharts.use([BarChart]);\n\n// after\nimport { GridComponent } from 'echarts/components';\necharts.use([BarChart, GridComponent]);","handlingStrategy":"validation","validationCode":"// on modular builds, ensure GridComponent is registered:\n//   echarts.use([GridComponent]);\n// before setOption, verify gridIndex/gridId resolve:\nconst grids = Array.isArray(option.grid) ? option.grid : (option.grid ? [option.grid] : []);\n(option.series || []).forEach((s: any) => {\n  if (s.gridIndex != null && s.gridIndex >= grids.length) {\n    console.error('[grid] series.gridIndex out of range: ' + s.gridIndex);\n  }\n});","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Register GridComponent on modular builds","Validate gridIndex/gridId reference an existing grid before setOption","Rely on the implicit default single grid when只有一个 grid is needed"],"tags":["grid","coordinate-system","modular-build","dev-only"],"backgroundTag":null,"analyzedSha":"30076aedcd7b7f65d8dd8e8d9ece46ce778133a3","analyzedAt":"2026-08-12T12:42:28.134Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}