{"record":{"id":"93b7e4a0ef9f1d7e","repo":"iOfficeAI/OfficeCLI","slug":"invalid-vertical-alignment-value-valid-value","errorCode":null,"errorMessage":"Invalid vertical alignment: '{value}'. Valid values: top, center, bottom.","messagePattern":"Invalid vertical alignment: '(.+?)'\\. Valid values: top, center, bottom\\.","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/officecli/Core/ExcelStyleManager.cs","lineNumber":1822,"sourceCode":"            \"center\" => HorizontalAlignmentValues.Center,\n            \"right\" => HorizontalAlignmentValues.Right,\n            \"justify\" => HorizontalAlignmentValues.Justify,\n            \"general\" => HorizontalAlignmentValues.General,\n            \"fill\" => HorizontalAlignmentValues.Fill,\n            \"centeracrossselection\" or \"centercontinuous\" => HorizontalAlignmentValues.CenterContinuous,\n            \"distributed\" => HorizontalAlignmentValues.Distributed,\n            _ => throw new ArgumentException($\"Invalid horizontal alignment: '{value}'. Valid values: left, center, right, justify.\")\n        };\n\n    private static VerticalAlignmentValues ParseVAlign(string value) =>\n        value.ToLowerInvariant() switch\n        {\n            \"top\" => VerticalAlignmentValues.Top,\n            \"center\" => VerticalAlignmentValues.Center,\n            \"bottom\" => VerticalAlignmentValues.Bottom,\n            \"justify\" => VerticalAlignmentValues.Justify,\n            \"distributed\" => VerticalAlignmentValues.Distributed,\n            _ => throw new ArgumentException($\"Invalid vertical alignment: '{value}'. Valid values: top, center, bottom.\")\n        };\n}\n","sourceCodeStart":1804,"sourceCodeEnd":1825,"githubUrl":"https://github.com/iOfficeAI/OfficeCLI/blob/1ced45e900782c5083ed550ddf328ee974e425e7/src/officecli/Core/ExcelStyleManager.cs#L1804-L1825","documentation":"Thrown by the Excel vertical-alignment parser when a value does not match a known token. Like the horizontal case, the message lists only 'top, center, bottom' even though the switch also accepts 'justify' and 'distributed'.","triggerScenarios":"Passing alignment/vertical= with a value outside the switch arms. The default arm throws, but the listed valid options are narrower than what the parser actually accepts (it also accepts justify and distributed).","commonSituations":"Typo such as 'middel' or 'Center '; whitespace not trimmed; confusion with the horizontal alignment vocabulary.","solutions":["Use one of the actually-supported values: top, center, bottom, justify, distributed.","Trim and lowercase the input.","Note the message is incomplete — if your value is justify/distributed it works despite not being listed."],"exampleFix":"// before\nalign[\"vertical\"] = \"middel\";\n// after\nalign[\"vertical\"] = \"middle\".ToLowerInvariant() == \"middle\" ? \"center\" : align[\"vertical\"]; // map 'middle'->'center'","handlingStrategy":"type-guard","validationCode":"static readonly HashSet<string> ValidVAlign = new(StringComparer.OrdinalIgnoreCase)\n{ \"top\",\"center\",\"bottom\",\"justify\",\"distributed\" };\nstatic string NormalizeVAlign(string v) => ValidVAlign.Contains(v?.Trim() ?? \"\") ? v.Trim().ToLowerInvariant() : throw new ArgumentException(\"invalid valign\");","typeGuard":"static bool IsValidVAlign(string v) => ValidVAlign.Contains(v?.Trim() ?? \"\");","tryCatchPattern":"try { SetAlign(vertical: value); }\ncatch (ArgumentException ex) when (ex.Message.StartsWith(\"Invalid vertical alignment\"))\n{ /* fallback to 'bottom' */ }","preventionTips":["Trim/lowercase vertical alignment values.","Note 'middle' is not accepted; use 'center'."],"tags":["excel","alignment","validation","error-message-mismatch"],"backgroundTag":null,"analyzedSha":"1ced45e900782c5083ed550ddf328ee974e425e7","analyzedAt":"2026-08-13T13:01:07.193Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}