iOfficeAI/OfficeCLI · error · ArgumentException

Chart at {parentPath} is not a standard chart (extended cx c

Error message

Chart at {parentPath} is not a standard chart (extended cx charts do not support add series).

What it means

Thrown by AddChartSeries when the target chart is an extended (cx) chart rather than a standard OOXML chart. Extended chart types (funnel, treemap, sunburst, histogram, boxWhisker, etc.) are backed by ChartExPart, which has a different XML structure (cx:nvChartSpace) and does not support the AddSeries operation. The check is chartInfo.StandardPart == null.

Source

Thrown at src/officecli/Handlers/Excel/ExcelHandler.Add.Chart.cs:391

    // range-referenced series (CONSISTENCY(chart-series-rangeref-cache)).
    private string AddChartSeries(string parentPath, Dictionary<string, string> properties)
    {
        var m = Regex.Match(parentPath, @"^/([^/]+)/chart\[(\d+)\]$");
        if (!m.Success)
            throw new ArgumentException(
                "series must be added to a chart parent: /SheetName/chart[N]");
        var sheetName = m.Groups[1].Value;
        var chartIdx = int.Parse(m.Groups[2].Value);
        var worksheet = FindWorksheet(sheetName)
            ?? throw new ArgumentException($"Sheet not found: {sheetName}");
        var drawingsPart = worksheet.DrawingsPart
            ?? throw new ArgumentException("Sheet has no drawings/charts");
        var excelCharts = GetExcelCharts(drawingsPart);
        if (chartIdx < 1 || chartIdx > excelCharts.Count)
            throw new ArgumentException($"Chart {chartIdx} not found (total: {excelCharts.Count})");
        var chartInfo = excelCharts[chartIdx - 1];
        if (chartInfo.StandardPart == null)
            throw new ArgumentException(
                $"Chart at {parentPath} is not a standard chart (extended cx charts do not support add series).");
        var chartPart = chartInfo.StandardPart;

        // Resolve range-reference values/categories against the workbook so
        // AddSeries seeds literal data (which becomes the cached snapshot).
        // Mutate `properties` in place instead of copying: enumerating a
        // TrackingPropertyDictionary into a fresh dict marks EVERY key as
        // consumed (see TrackingPropertyDictionary.GetEnumerator), which
        // silently swallows unsupported_property reporting for unknown keys.
        // TryGetValue / indexer / Remove are the tracked access routes.
        string? valuesRef = null, categoriesRef = null;
        List<string>? cachedCats = null;
        if (properties.TryGetValue("values", out var valRaw) && ChartHelper.IsRangeReference(valRaw))
        {
            valuesRef = ChartHelper.NormalizeRangeReference(valRaw, sheetName);
            var cells = ResolveRangeToCellValues(valRaw, sheetName);
            if (cells != null)
                properties["values"] = string.Join(",", cells.Select(v =>

View on GitHub (pinned to 1ced45e900)

Solutions

  1. Recreate the chart as a standard type (bar, line, pie, etc.) if you need to append series dynamically.
  2. Provide all series upfront when creating an extended-type chart via data= or multiple seriesN= properties.
  3. If you must use an extended type, delete and recreate the chart with the full series set rather than appending.

Example fix

// before (treemap is an extended chart type)
add /Sheet1/chart --type chart --chartType treemap --data "S1:1,2,3"
add /Sheet1/chart[1] --type chart-series --data "S2:5,6,7"
// after (use a standard type, or supply all series at creation)
add /Sheet1/chart --type chart --chartType bar --data "S1:1,2,3;S2:5,6,7"
Defensive patterns

Strategy: validation

Validate before calling

// Check whether the chart is an extended (cx) chart before appending series
var chartInfo = charts[chartIdx - 1];
if (chartInfo.StandardPart == null)
    throw new InvalidOperationException(
        $"Chart at {parentPath} is an extended (cx) chart; AddSeries is not supported. " +
        "Recreate with all series, or use a standard chart type.");

Type guard

static bool IsStandardChart(ChartInfo info) => info.StandardPart != null;

Try / catch

try { handler.AddChartSeries(parentPath, properties); }
catch (ArgumentException ex) when (ex.Message.Contains("not a standard chart"))
{
    Console.Error.WriteLine($"{ex.Message} Recreate the chart with all series upfront.");
}

Prevention

When it happens

Trigger: Creating a chart with an extended type (e.g. chartType=treemap) and then calling add /Sheet/chart[N] --type chart-series. The chart resolves successfully (index is valid) but its StandardPart is null because it is a ChartEx.

Common situations: User creates a modern chart type (treemap, funnel, sunburst) and then tries to append series the same way as for bar/line/pie charts. The error is explicit because AddSeries only works on ChartPart (standard charts), not ChartExPart.

Related errors


AI-assisted analysis of iOfficeAI/OfficeCLI@1ced45e900 (2026-08-13). Data as JSON: /api/errors/8a53d19a40b3963d. Report an issue: GitHub.