{"record":{"id":"e574d486c319b147","repo":"iOfficeAI/OfficeCLI","slug":"unknown-underline-value-shpunder-valid-singl","errorCode":null,"errorMessage":"Unknown underline value '{shpUnder}'. Valid: single, double, none (true/false).","messagePattern":"Unknown underline value '(.+?)'\\. Valid: single, double, none \\(true/false\\)\\.","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/officecli/Handlers/Excel/ExcelHandler.Add.Drawings.cs","lineNumber":816,"sourceCode":"                ?? properties.GetValueOrDefault(\"font.bold\");\n            if (rawBold != null && IsTruthy(rawBold))\n                rPr.Bold = true;\n\n            string? rawItalic = properties.GetValueOrDefault(\"italic\")\n                ?? properties.GetValueOrDefault(\"font.italic\");\n            if (rawItalic != null && IsTruthy(rawItalic))\n                rPr.Italic = true;\n\n            if (properties.TryGetValue(\"font.underline\", out var shpUnder)\n                || properties.TryGetValue(\"underline\", out shpUnder))\n            {\n                var uv = shpUnder.ToLowerInvariant();\n                rPr.Underline = uv switch\n                {\n                    \"true\" or \"single\" or \"sng\" => Drawing.TextUnderlineValues.Single,\n                    \"double\" or \"dbl\" => Drawing.TextUnderlineValues.Double,\n                    \"none\" or \"false\" => Drawing.TextUnderlineValues.None,\n                    _ => throw new ArgumentException(\n                        $\"Unknown underline value '{shpUnder}'. Valid: single, double, none (true/false).\")\n                };\n            }\n\n            // Fill (color) before fonts\n            string? rawColor = properties.GetValueOrDefault(\"color\")\n                ?? properties.GetValueOrDefault(\"font.color\");\n            if (rawColor != null)\n            {\n                rPr.AppendChild(DrawingColorBuilder.BuildSolidFill(rawColor));\n            }\n\n            // Text-level effects for fill=none shapes\n            var isNoFill = properties.TryGetValue(\"fill\", out var f) && f.Equals(\"none\", StringComparison.OrdinalIgnoreCase);\n            if (isNoFill)\n            {\n                // CONSISTENCY(effect-list-schema-order): glow → outerShdw per CT_EffectList\n                Drawing.Glow? txtGlowEl = null;","sourceCodeStart":798,"sourceCodeEnd":834,"githubUrl":"https://github.com/iOfficeAI/OfficeCLI/blob/1ced45e900782c5083ed550ddf328ee974e425e7/src/officecli/Handlers/Excel/ExcelHandler.Add.Drawings.cs#L798-L834","documentation":"Thrown when the run-level underline property (`font.underline` or `underline`) is not one of the recognized tokens. The switch accepts single/sng and double/dbl and none/false, plus boolean true/single. Any other token — e.g. a numeric `1`, `wave`, `dotted`, or a localized word — hits the default arm and throws.","triggerScenarios":"Passing `--prop font.underline=1` (numeric), `--prop underline=wavy`, `--prop underline=heavy`, or a style name from a different app (Word's underline vocabulary). The lookup is on `font.underline` first, then falls back to `underline`, so either key triggers the same switch.","commonSituations":"Assuming Excel/Word's full underline spectrum exists in Drawing ML run properties (it is only single/double/none here); using a boolean literal that isn't `true`/`false`.","solutions":["Use single, double, or none (aliases sng, dbl, true/false are also accepted).","Drop the underline property if no underline is desired (none is the implicit default)."],"exampleFix":"// before\nadd ./book.xlsx /Sheet1 shape --type textbox --prop font.text=Hi --prop underline=1\n// after\nadd ./book.xlsx /Sheet1 shape --type textbox --prop font.text=Hi --prop underline=single","handlingStrategy":"type-guard","validationCode":"var validUnderline = new[]{\"single\",\"sng\",\"double\",\"dbl\",\"none\",\"true\",\"false\"};\nif (!validUnderline.Contains((underline ?? \"\").ToLowerInvariant()))\n    throw new InvalidOperationException($\"Invalid underline '{underline}'\");","typeGuard":"static readonly HashSet<string> UnderlineTokens = new(StringComparer.OrdinalIgnoreCase)\n    {\"single\",\"sng\",\"double\",\"dbl\",\"none\",\"true\",\"false\"};\nstatic bool IsValidUnderline(string? v) => v is not null && UnderlineTokens.Contains(v);","tryCatchPattern":"try { handler.Add(...); }\ncatch (ArgumentException ex) when (ex.Message.Contains(\"Unknown underline\"))\n{ /* map to single/none as a safe default or reprompt */ }","preventionTips":["Remember the run-level underline vocabulary is only single/double/none (plus booleans).","Do not pass numeric 1/0 or Word-style underline names."],"tags":["excel","shape","font","underline","enum-value","input-validation"],"backgroundTag":null,"analyzedSha":"1ced45e900782c5083ed550ddf328ee974e425e7","analyzedAt":"2026-08-13T13:01:07.193Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}