iOfficeAI/OfficeCLI · error · ArgumentException

Series '{name}' has no data values. Expected format: 'Name:1

Error message

Series '{name}' has no data values. Expected format: 'Name:1,2,3'

What it means

Thrown by ParseLiteralSeriesData (ChartHelper.cs:297) when a series part in a data= (or seriesN=) value contains a colon (so a name/value split is attempted) but the value substring after the last colon is empty. The split deliberately uses the LAST colon so colon-containing series names (e.g. 'Persons (Data year: 2021)') survive. A series with a name but no numbers is invalid.

Source

Thrown at src/officecli/Core/Chart/ChartHelper.cs:297

                // Check if comma-separated parts each contain a colon (name:value pairs)
                var commaParts = dataStr.Split(',', StringSplitOptions.RemoveEmptyEntries);
                if (commaParts.Length > 1 && commaParts.All(p => p.Contains(':')))
                    seriesParts = commaParts;
                else
                    seriesParts = new[] { dataStr };
            }

            foreach (var seriesPart in seriesParts)
            {
                // Split on the LAST colon: the value list is colon-free, so the
                // rightmost colon separates a (possibly colon-containing) series
                // name from its values, e.g. "Persons (Data year: 2021):1,2,3".
                var colonIdx = seriesPart.LastIndexOf(':');
                if (colonIdx < 0) continue;
                var name = seriesPart[..colonIdx].Trim();
                var valStr = seriesPart[(colonIdx + 1)..].Trim();
                if (string.IsNullOrEmpty(valStr))
                    throw new ArgumentException($"Series '{name}' has no data values. Expected format: 'Name:1,2,3'");
                var vals = ParseSeriesValues(valStr, name);
                result.Add((name, vals));
            }
            return result;
        }

        for (int i = 1; i <= 20; i++)
        {
            // Read both keys up front so TrackingPropertyDictionary marks each
            // consumed regardless of which branch supplies the values. Without
            // this, `series{i}=` combined with `series{i}.name=` fell through
            // to UNSUPPORTED + silent value drop (interview-edit R4 major).
            var hasDotName = properties.TryGetValue($"series{i}.name", out var dotName);
            var hasDotValues = properties.TryGetValue($"series{i}.values", out var dotValues);
            var hasLegacy = properties.TryGetValue($"series{i}", out var legacyStr);

            // Check for dotted syntax first: series1.name, series1.values
            if (hasDotName || hasDotValues)

View on GitHub (pinned to 1ced45e900)

Solutions

  1. Provide at least one comma-separated number after the colon: data=Sales:10,20,30.
  2. If the series genuinely has no data, omit it entirely rather than emitting Name:.
  3. Validate that each series part matches Name:v1,v2,... before submitting.

Example fix

// before
data=Sales:
// after
data=Sales:10,20,30
Defensive patterns

Strategy: validation

Validate before calling

static string ValidateSeriesPart(string part)
{
    var idx = part.LastIndexOf(':');
    if (idx < 0) return part;
    var valStr = part[(idx+1)..].Trim();
    if (string.IsNullOrEmpty(valStr)) throw new ArgumentException($"series part '{part[..idx]}' has no values");
    return part;
}

Type guard

static bool SeriesPartHasValues(string part)
{
    var idx = part.LastIndexOf(':');
    return idx < 0 || !string.IsNullOrWhiteSpace(part[(idx+1)..]);
}

Try / catch

try { /* add chart data=... */ }
catch (ArgumentException ex) when (ex.Message.Contains("has no data values"))
{ /* drop empty series or supply values */ }

Prevention

When it happens

Trigger: Setting data=Sales: or series1=Revenue: (name followed by colon and nothing), or data=A:;B:1,2 (first series empty). Also data=Name: (trailing colon after trimming whitespace).

Common situations: Building a data string with a trailing colon from a template; a series whose value list was dropped during copy-paste; splitting a spec and rejoining with a colon but forgetting the value half.

Related errors


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