iOfficeAI/OfficeCLI · error · ArgumentException
Unknown chart type: '{chartType}'. Supported types: column,
Error message
Unknown chart type: '{chartType}'. Supported types: column, bar, line, pie, doughnut, area, scatter, bubble, radar, stock, combo, waterfall, funnel, treemap, sunburst, boxWhisker, histogram, pareto. Modifiers: 3d (e.g. column3d), stacked (e.g. stackedColumn), percentStacked (e.g. percentStackedBar). What it means
Thrown by ParseChartType (ChartHelper.cs:57) when the chart type, after normalizing and stripping 3d/stacked/percentStacked modifiers, does not match any supported base type. The message lists the full supported set (column, bar, line, pie, doughnut, area, scatter, bubble, radar, stock, combo, waterfall) plus the available modifiers. This is the top-level type parser, so any unrecognised chart type fails here.
Source
Thrown at src/officecli/Core/Chart/ChartHelper.cs:57
ct = ct.Replace("percentstacked", "").Replace("pstacked", "").Replace("stacked", "");
var kind = ct switch
{
"bar" => "bar",
"column" or "col" => "column",
"line" => "line",
"pie" => "pie",
"pieofpie" => "pieofpie",
"barofpie" => "barofpie",
"doughnut" or "donut" => "doughnut",
"area" => "area",
"scatter" or "xy" => "scatter",
"bubble" => "bubble",
"radar" or "spider" => "radar",
"stock" or "ohlc" => "stock",
"combo" => "combo",
"waterfall" or "wf" => "waterfall",
_ => throw new ArgumentException(
$"Unknown chart type: '{chartType}'. Supported types: " +
"column, bar, line, pie, doughnut, area, scatter, bubble, radar, stock, combo, waterfall, " +
"funnel, treemap, sunburst, boxWhisker, histogram, pareto. " +
"Modifiers: 3d (e.g. column3d), stacked (e.g. stackedColumn), percentStacked (e.g. percentStackedBar).")
};
return (kind, is3D, stacked, percentStacked);
}
/// <summary>
/// Extended series info that may contain cell references instead of literal data.
/// </summary>
internal class SeriesInfo
{
public string Name { get; set; } = "";
public double[]? Values { get; set; }
public string? ValuesRef { get; set; } // e.g. "Sheet1!$B$2:$B$13"
public string? CategoriesRef { get; set; } // e.g. "Sheet1!$A$2:$A$13"View on GitHub (pinned to 1ced45e900)
Solutions
- Use one of the parsed base types: bar, column/col, line, pie, pieOfPie, barOfPie, doughnut/donut, area, scatter/xy, bubble, radar/spider, stock/ohlc, combo, waterfall/wf.
- Drop the trailing 'Chart'/'Plot' suffix — the parser wants the bare type name.
- If you need funnel/treemap/sunburst/boxWhisker/histogram/pareto, note they are advertised but not implemented in this switch; verify support before relying on them.
Example fix
// before type=barchart // after type=bar
Defensive patterns
Strategy: validation
Validate before calling
static readonly HashSet<string> BaseChartTypes = new(StringComparer.OrdinalIgnoreCase)
{ "bar","column","col","line","pie","pieofpie","barofpie","doughnut","donut","area","scatter","xy","bubble","radar","spider","stock","ohlc","combo","waterfall","wf" };
static string ValidateBaseChartType(string type)
{
var ct = SchemaKeyNormalizer.Normalize(type).Replace("3d","").Replace("percentstacked","").Replace("pstacked","").Replace("stacked","");
return BaseChartTypes.Contains(ct) ? type : throw new ArgumentException($"unsupported chart type '{type}'");
} Type guard
static bool IsKnownChartType(string type)
{
var ct = SchemaKeyNormalizer.Normalize(type).Replace("3d","").Replace("percentstacked","").Replace("pstacked","").Replace("stacked","");
return BaseChartTypes.Contains(ct);
} Try / catch
try { /* set chart type=... */ }
catch (ArgumentException ex) when (ex.Message.Contains("Unknown chart type"))
{ /* present the supported-type list to the user */ } Prevention
- Pass the bare type name without a trailing 'Chart'/'Plot' suffix.
- Note funnel/treemap/sunburst/boxWhisker/histogram/pareto are advertised but not wired into the parser — verify before use.
- Apply modifiers (3d, stacked, percentStacked) only to types that support them.
When it happens
Trigger: Setting type=<unknown>, e.g. 'scatterPlot', 'barchart', 'radarChart', 'histogram' (note: histogram is listed in the message but is not a parsed arm here), 'sunburst', 'treemap', 'funnel' (also listed but not in the switch).
Common situations: Appending 'Chart'/'Plot' to the type name; using a type mentioned in the error's supported list that is actually not yet wired into the switch (funnel/treemap/sunburst/boxWhisker/histogram/pareto); typos like 'col' is accepted but 'colmn' is not.
Related errors
- Chart type '{chartType}' is not supported. OOXML has no Scat
- Invalid comboTypes token '{t}'. Expected bar/column/line/are
- Unknown chart type: '{kind}'. Supported: column, bar, line,
- {fullKey}: expected boolean (true/false/1/0/yes/no/on/off),
- Invalid legend position '{value}'. Valid: none, top, bottom,
AI-assisted analysis of iOfficeAI/OfficeCLI@1ced45e900 (2026-08-13).
Data as JSON: /api/errors/3b4ded82715b19df.
Report an issue: GitHub.