apache/echarts · error

{} "{}" not found

Error message

{} "{}" not found

What it means

DEV-only guard in findAxisModels (cartesianAxisHelper): for a cartesian2d series, both an xAxisModel and a yAxisModel must be resolvable via seriesModel.getReferringComponents using SINGLE_REFERRING semantics. If either is missing (no axis component, or index/id mismatch), it throws with the axisType and resolved index/id. Stripped in production.

Source

Thrown at src/coord/cartesian/cartesianAxisHelper.ts:145

}

export function findAxisModels(seriesModel: SeriesModel): {
    xAxisModel: CartesianAxisModel;
    yAxisModel: CartesianAxisModel;
} {
    const axisModelMap = {
        xAxisModel: null,
        yAxisModel: null
    } as ReturnType<typeof findAxisModels>;
    zrUtil.each(axisModelMap, function (v, key) {
        const axisType = key.replace(/Model$/, '');
        const axisModel = seriesModel.getReferringComponents(
            axisType, SINGLE_REFERRING
        ).models[0] as CartesianAxisModel;

        if (__DEV__) {
            if (!axisModel) {
                throw new Error(axisType + ' "' + zrUtil.retrieve3(
                    seriesModel.get(axisType + 'Index' as any),
                    seriesModel.get(axisType + 'Id' as any),
                    0
                ) + '" not found');
            }
        }

        axisModelMap[key] = axisModel;
    });

    return axisModelMap;
}

export function createCartesianAxisViewCommonPartBuilder(
    gridRect: LayoutRect,
    cartesians: Cartesian2D[],
    axisModel: CartesianAxisModel,
    api: ExtensionAPI,

View on GitHub (pinned to 30076aedcd)

Solutions

  1. Register the axis components on modular builds (GridComponent brings xAxis/yAxis)
  2. Ensure every axisIndex/axisId references an existing axis
  3. Remove stale axisIndex references when axes are removed

Example fix

// before (modular)
import * as echarts from 'echarts/core';
import { LineChart } from 'echarts/charts';
echarts.use([LineChart]); // no axis components -> yAxis '0' not found

// after
import { GridComponent } from 'echarts/components';
echarts.use([LineChart, GridComponent]);
Defensive patterns

Strategy: validation

Validate before calling

const xAxes = Array.isArray(option.xAxis) ? option.xAxis : (option.xAxis ? [option.xAxis] : []);
const yAxes = Array.isArray(option.yAxis) ? option.yAxis : (option.yAxis ? [option.yAxis] : []);
(option.series || []).forEach((s: any) => {
  const xi = s.xAxisIndex ?? 0;
  const yi = s.yAxisIndex ?? 0;
  if (xi >= xAxes.length) console.error('xAxisIndex ' + xi + ' not found');
  if (yi >= yAxes.length) console.error('yAxisIndex ' + yi + ' not found');
});
// also register GridComponent (xAxis/yAxis) on modular builds

Prevention

When it happens

Trigger: Cartesian series whose xAxisIndex/xAxisId or yAxisIndex/yAxisId do not match any registered axis; axis component not imported on modular builds; axisIndex out of range.

Common situations: Modular build missing the CartesianAxis components; axisIndex beyond the declared axes array; axisId typo; series referencing an axis before it is declared.

Related errors


AI-assisted analysis of apache/echarts@30076aedcd (2026-08-12). Data as JSON: /api/errors/22addb707eabe780. Report an issue: GitHub.