{"record":{"id":"df395771af90fc16","repo":"apache/echarts","slug":"invalid-coords-lines-must-have-2d-coords-array","errorCode":null,"errorMessage":"Invalid coords {}. Lines must have 2d coords array in data item.","messagePattern":"Invalid coords (.+?)\\. Lines must have 2d coords array in data item\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/chart/lines/LinesSeries.ts","lineNumber":217,"sourceCode":"            }\n            else {\n                this._flatCoords = concatArray(this._flatCoords, result.flatCoords);\n                this._flatCoordsOffset = concatArray(this._flatCoordsOffset, result.flatCoordsOffset);\n            }\n            params.data = new Float32Array(result.count);\n        }\n\n        this.getRawData().appendData(params.data);\n    }\n\n    _getCoordsFromItemModel(idx: number) {\n        const itemModel = this.getData().getItemModel<LinesDataItemOption>(idx);\n        const coords = (itemModel.option instanceof Array)\n            ? itemModel.option : itemModel.getShallow('coords');\n\n        if (__DEV__) {\n            if (!(coords instanceof Array && coords.length > 0 && coords[0] instanceof Array)) {\n                throw new Error(\n                    'Invalid coords ' + JSON.stringify(coords) + '. Lines must have 2d coords array in data item.'\n                );\n            }\n        }\n        return coords;\n    }\n\n    getLineCoordsCount(idx: number) {\n        if (this._flatCoordsOffset) {\n            return this._flatCoordsOffset[idx * 2 + 1];\n        }\n        else {\n            return this._getCoordsFromItemModel(idx).length;\n        }\n    }\n\n    getLineCoords(idx: number, out: number[][]) {\n        if (this._flatCoordsOffset) {","sourceCodeStart":199,"sourceCodeEnd":235,"githubUrl":"https://github.com/apache/echarts/blob/30076aedcd7b7f65d8dd8e8d9ece46ce778133a3/src/chart/lines/LinesSeries.ts#L199-L235","documentation":"DEV-only guard in LinesSeries._getCoordsFromItemModel: a 'lines' series data item must provide coords as a 2D array (an array of [x,y] pairs), because each data item may itself contain multiple polyline segments. The check verifies coords is an Array, non-empty, and coords[0] is itself an Array. Stripped in production.","triggerScenarios":"Passing a data item like { coords: [116, 39] } (flat pair), { coords: 'foo' }, omitting coords, or supplying a 1D array of numbers.","commonSituations":"Confusing the 'lines' series data shape with the regular 'line' series; data export that flattened nested arrays; truncating coords during serialization.","solutions":["Provide coords as [[x1,y1],[x2,y2],...]","Or pass the data item itself as a 2D array","Validate the data shape before setOption"],"exampleFix":"// before\n{ type: 'lines', data: [{ coords: [116, 39] }] }\n\n// after\n{ type: 'lines', data: [{ coords: [[116, 39], [121, 31]] }] }","handlingStrategy":"validation","validationCode":"(option.series || []).filter((s: any) => s.type === 'lines').forEach((s: any) => {\n  (s.data || []).forEach((d: any) => {\n    const c = Array.isArray(d) ? d : d && d.coords;\n    if (!(Array.isArray(c) && c.length > 0 && Array.isArray(c[0]))) {\n      console.error('[lines] data item has invalid coords', d);\n    }\n  });\n});","typeGuard":"const is2DCoords = (c: unknown): c is number[][] =>\n  Array.isArray(c) && c.length > 0 && Array.isArray(c[0]);","tryCatchPattern":null,"preventionTips":["Treat each lines data item's coords as number[][]","Validate the data shape before setOption","Distinguish the 'lines' series shape from the regular 'line' series"],"tags":["lines-series","data-format","dev-only"],"backgroundTag":null,"analyzedSha":"30076aedcd7b7f65d8dd8e8d9ece46ce778133a3","analyzedAt":"2026-08-12T12:42:28.134Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}