iOfficeAI/OfficeCLI · warning · ArgumentException
Axis not available on chart {caChartIdx}: extended charts no
Error message
Axis not available on chart {caChartIdx}: extended charts not supported. What it means
Thrown for /Sheet/chart[N]/axis[@role=R] when chart N is an 'extended' chart (Office 2016+ chartEx format: treemap, sunburst, waterfall, histogram, boxAndWhisker, funnel, etc.). Extended charts have no standard ChartSpace and therefore no addressable axes via this API; they store series in the cx: namespace instead. The chart node itself is still readable — it surfaces chartType and seriesCount in Format rather than series Children.
Source
Thrown at src/officecli/Handlers/Excel/ExcelHandler.Query.cs:679
}
// Chart axis-by-role sub-path: /Sheet1/chart[N]/axis[@role=ROLE].
// Per schemas/help/pptx/chart-axis.json (shared contract).
var chartAxisGetMatch = Regex.Match(cellRef,
@"^chart\[(\d+)\]/axis\[@role=([a-zA-Z0-9_]+)\]$");
if (chartAxisGetMatch.Success)
{
var caChartIdx = int.Parse(chartAxisGetMatch.Groups[1].Value);
var caRole = chartAxisGetMatch.Groups[2].Value;
var caDrawingsPart = worksheet.DrawingsPart;
if (caDrawingsPart == null)
throw new ArgumentException($"No charts found in sheet");
var caAllCharts = GetExcelCharts(caDrawingsPart);
if (caChartIdx < 1 || caChartIdx > caAllCharts.Count)
throw new ArgumentException($"Chart index {caChartIdx} out of range (1-{caAllCharts.Count})");
var caChartInfo = caAllCharts[caChartIdx - 1];
if (caChartInfo.IsExtended || caChartInfo.StandardPart?.ChartSpace == null)
throw new ArgumentException($"Axis not available on chart {caChartIdx}: extended charts not supported.");
var axisNode = ChartHelper.BuildAxisNode(caChartInfo.StandardPart.ChartSpace, caRole, path);
if (axisNode == null)
throw new ArgumentException($"Axis with role '{caRole}' not found on chart {caChartIdx}.");
return axisNode;
}
// Chart path: /Sheet1/chart[N] or /Sheet1/chart[N]/series[K]
var chartMatch = Regex.Match(cellRef, @"^chart\[(\d+)\](?:/series\[(\d+)\])?$");
if (chartMatch.Success)
{
var chartIdx = int.Parse(chartMatch.Groups[1].Value);
var drawingsPart = worksheet.DrawingsPart;
if (drawingsPart == null)
throw new ArgumentException($"No charts found in sheet");
var allCharts = GetExcelCharts(drawingsPart);
if (chartIdx < 1 || chartIdx > allCharts.Count)
throw new ArgumentException($"Chart index {chartIdx} out of range (1-{allCharts.Count})");View on GitHub (pinned to 1ced45e900)
Solutions
- Detect extended charts first: their node sets seriesCount in Format and has no series Children — treat those as axis-less.
- Restrict axis queries to standard (classic) charts.
- Catch ArgumentException and fall back to reading chart[N]'s summary properties (chartType, seriesCount).
Example fix
// before
var axis = handler.Get("/Sheet1/chart[2]/axis[@role=primary]"); // throws if extended
// after
var chart = handler.Get("/Sheet1/chart[2]");
bool isExtended = chart.Format.ContainsKey("seriesCount") && !chart.Children.Any(c => c.Type == "series");
if (isExtended) { /* no axes; use chart.Format["chartType"] / ["seriesCount"] */ }
else { var axis = handler.Get("/Sheet1/chart[2]/axis[@role=primary]"); } Defensive patterns
Strategy: try-catch
Type guard
// best-effort extended-chart tell: seriesCount in Format, no series Children
static bool LooksExtended(DocumentNode chart) =>
chart.Format.ContainsKey("seriesCount") && !chart.Children.Any(c => c.Type == "series"); Try / catch
var chart = handler.Get("/Sheet1/chart[2]");
if (LooksExtended(chart)) { /* no axes; use chart.Format["chartType"] / ["seriesCount"] */ return null; }
try { return handler.Get("/Sheet1/chart[2]/axis[@role=primary]"); }
catch (ArgumentException ex) when (ex.Message.Contains("extended")) { return null; } Prevention
- Modern (2016+) chart types (treemap, sunburst, waterfall, etc.) are extended and have no addressable axes.
- Detect extended charts by the seriesCount Format key + absent series Children.
- Restrict axis queries to standard (classic) charts.
When it happens
Trigger: Requesting an axis on a modern chart type inserted by Excel 2016+. handler.Get("/Sheet1/chart[2]/axis[@role=primary]") where chart[2] is an extended chart. Code that assumes every chart exposes a category/value axis.
Common situations: Modern chart types (2016+) that lack a classic axis model. Workbook whose charts were upgraded to the extended format. Generic axis-walking code applied to all charts.
Related errors
- No charts found in sheet
- Chart index {caChartIdx} out of range (1-{caAllCharts.Count}
- Axis with role '{caRole}' not found on chart {caChartIdx}.
- Chart index {chartIdx} out of range (1-{allCharts.Count})
- Series {seriesIdx} not found (total: {seriesChildren.Count})
AI-assisted analysis of iOfficeAI/OfficeCLI@1ced45e900 (2026-08-13).
Data as JSON: /api/errors/6157443faa90ecc3.
Report an issue: GitHub.