{"record":{"id":"571b72fe52a02f93","repo":"iOfficeAI/OfficeCLI","slug":"invalid-data-value-trimmed-in-series-seriesn","errorCode":null,"errorMessage":"Invalid data value '{trimmed}' in series '{seriesName}'. Expected comma-separated finite numbers (e.g. '1,2,3').","messagePattern":"Invalid data value '(.+?)' in series '(.+?)'\\. Expected comma-separated finite numbers \\(e\\.g\\. '1,2,3'\\)\\.","errorType":"validation","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/officecli/Core/Chart/ChartHelper.cs","lineNumber":511,"sourceCode":"                    properties[dottedKey] = nameVal;\n                // Remove the flat key so SetChartProperties' dispatch loop\n                // doesn't also iterate it — the legacy `series{N}=` branch\n                // does int.TryParse on the suffix (\"2Name\") and reports it\n                // as unsupported. TryGetValue above already marked the\n                // original input consumed for handler-as-truth tracking.\n                properties.Remove(flatKey);\n            }\n        }\n    }\n\n    private static double[] ParseSeriesValues(string valStr, string seriesName)\n    {\n        return valStr.Split(',').Select(v =>\n        {\n            var trimmed = v.Trim();\n            if (!double.TryParse(trimmed, System.Globalization.CultureInfo.InvariantCulture, out var num)\n                || double.IsNaN(num) || double.IsInfinity(num))\n                throw new ArgumentException($\"Invalid data value '{trimmed}' in series '{seriesName}'. Expected comma-separated finite numbers (e.g. '1,2,3').\");\n            return num;\n        }).ToArray();\n    }\n\n    internal static string[]? ParseCategories(Dictionary<string, string> properties)\n    {\n        if (!properties.TryGetValue(\"categories\", out var catStr)) return null;\n        // If the value is a cell range reference, don't treat as literal categories\n        if (IsRangeReference(catStr)) return null;\n        return catStr.Split(',').Select(c => c.Trim()).ToArray();\n    }\n\n    // BUG-DUMP-R36-3: series indices (0-based) whose dump carried per-point\n    // <c:dPt> styling (and/or a verbatim series <c:spPr>) but NO series-level\n    // fill key (series{N}.color / .gradient / .spPr). For these the source had\n    // no series-level <c:spPr>; the chart builder must therefore NOT inject the\n    // Office accent1 default — doing so plants a spurious solidFill that a\n    // partial-dPt series would visibly show. Mirrors the spec \"only emit a","sourceCodeStart":493,"sourceCodeEnd":529,"githubUrl":"https://github.com/iOfficeAI/OfficeCLI/blob/1ced45e900782c5083ed550ddf328ee974e425e7/src/officecli/Core/Chart/ChartHelper.cs#L493-L529","documentation":"Thrown by ParseSeriesValues (ChartHelper.cs:511) when a token in a comma-separated series value list fails double.TryParse (invariant culture) or is NaN/Infinity. This guard is shared by the Add path (literal series values) and the dotted seriesN.values path, so both reject non-finite/unparseable tokens consistently. OOXML c:v requires a finite double, so this prevents invalid text from reaching the XML.","triggerScenarios":"Setting series1=Sales:10,abc,30, data=Q1:1,NaN,3, or a series value list containing a locale-formatted number like '1,5' (which invariant culture reads as two tokens).","commonSituations":"Forwarding NaN/Infinity from computation; locale decimal separators (European comma) colliding with the comma delimiter; named ranges or text leaking into a literal value list (use a cell reference instead).","solutions":["Pass finite numbers with a dot decimal separator: Sales:10,20.5,30.","Filter NaN/Infinity before serializing the list.","Use a cell-range reference (series1.values=Sheet1!B2:B4) for workbook-backed data instead of literal numbers."],"exampleFix":"// before\nseries1=Sales:10,abc,30\n// after\nseries1=Sales:10,20,30","handlingStrategy":"validation","validationCode":"static double[] ValidateSeriesValues(string valStr)\n{\n    return valStr.Split(',').Select(v =>\n    {\n        var t = v.Trim();\n        if (!double.TryParse(t, System.Globalization.CultureInfo.InvariantCulture, out var n) || double.IsNaN(n) || double.IsInfinity(n))\n            throw new ArgumentException($\"invalid value '{t}'\");\n        return n;\n    }).ToArray();\n}","typeGuard":"static bool IsFiniteSeriesValues(string valStr) =>\n    valStr.Split(',').All(v => double.TryParse(v.Trim(), System.Globalization.CultureInfo.InvariantCulture, out var n) && !double.IsNaN(n) && !double.IsInfinity(n));","tryCatchPattern":"try { /* add chart series1=Name:... */ }\ncatch (ArgumentException ex) when (ex.Message.Contains(\"Invalid data value\"))\n{ /* sanitize list: filter NaN/Infinity, fix locale, or switch to cell ref */ }","preventionTips":["Serialize numbers with invariant culture (dot decimal separator).","Filter NaN/Infinity before building the comma-separated list.","Prefer cell-range references over literal lists for workbook-backed data."],"tags":["chart","series","values","validation"],"backgroundTag":null,"analyzedSha":"1ced45e900782c5083ed550ddf328ee974e425e7","analyzedAt":"2026-08-13T13:01:07.193Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}