{"record":{"id":"f45caf3fb77f46d1","repo":"iOfficeAI/OfficeCLI","slug":"invalid-key-value-valid-true-false","errorCode":null,"errorMessage":"invalid {key}: '{value}'. Valid: true, false","messagePattern":"invalid (.+?): '(.+?)'\\. Valid: true, false","errorType":"validation","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/officecli/Core/PivotTableHelper.Definition.cs","lineNumber":87,"sourceCode":"        }\n        return pivotDef.PivotTableStyle;\n    }\n\n    /// <summary>\n    /// Strict bool parser for pivot style toggles. Accepts true/false/1/0/\n    /// yes/no/on/off (case-insensitive) and throws ArgumentException on\n    /// anything else. CONSISTENCY(strict-enums): matches the sort-mode and\n    /// showdataas reject-unknown behavior introduced in the recent pivot\n    /// validation sweep — silent fallbacks mask typos.\n    /// </summary>\n    private static bool ParsePivotStyleBool(string key, string value)\n    {\n        switch ((value ?? \"\").Trim().ToLowerInvariant())\n        {\n            case \"true\": case \"1\": case \"yes\": case \"on\": return true;\n            case \"false\": case \"0\": case \"no\": case \"off\": return false;\n            default:\n                throw new ArgumentException(\n                    $\"invalid {key}: '{value}'. Valid: true, false\");\n        }\n    }\n\n    /// <summary>\n    /// Apply the five &lt;pivotTableStyleInfo&gt; bool attributes from the\n    /// caller's properties dict onto an existing PivotTableStyle element.\n    /// Only keys actually present in the dict are applied, so Set\n    /// operations can change one toggle without clobbering the others.\n    /// Accepts both canonical (showColStripes) and OOXML-verbatim\n    /// (showColumnStripes) spellings for the \"col/column\" siblings,\n    /// matching the existing alias policy.\n    /// </summary>\n    private static void ApplyPivotStyleInfoProps(\n        PivotTableStyle styleInfo,\n        Dictionary<string, string> properties)\n    {\n        foreach (var (rawKey, value) in properties)","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/iOfficeAI/OfficeCLI/blob/1ced45e900782c5083ed550ddf328ee974e425e7/src/officecli/Core/PivotTableHelper.Definition.cs#L69-L105","documentation":"ArgumentException thrown by ParsePivotStyleBool when a pivot-table style boolean key (showRowStripes, showColumnStripes, showRowHeaders, showColumnHeaders, showLastColumn) receives a value that is not one of the accepted spellings. Accepted (case-insensitive): true/1/yes/on and false/0/no/off. Anything else is rejected to avoid silent fallbacks masking typos (CONSISTENCY strict-enums).","triggerScenarios":"Setting a pivot table styleInfo toggle with an unrecognized value, e.g. showRowStripes=\"yep\", showColStripes=\"enable\", showLastColumn=\"t\", or showColumnStripes=\"\".","commonSituations":"Using abbreviations ('t'/'f', 'y'/'n'); passing 'enable'/'disable' or 'checked'/'unchecked'; empty value from an unset JSON key; locale-specific words.","solutions":["Use one of the accepted spellings: true/false, 1/0, yes/no, or on/off.","For the column variants both spellings are accepted as keys (showColStripes or showColumnStripes), but the VALUE must still be one of the accepted bool spellings.","Normalize upstream boolean input to true/false before setting the pivot style property."],"exampleFix":"// before\nshowRowStripes=\"yep\"\n// after\nshowRowStripes=\"true\"","handlingStrategy":"validation","validationCode":"static readonly System.Collections.Generic.HashSet<string> PivotBoolWords =\n    new(System.StringComparer.OrdinalIgnoreCase) { \"true\",\"1\",\"yes\",\"on\",\"false\",\"0\",\"no\",\"off\" };\nstatic bool IsPivotStyleBool(string value) => PivotBoolWords.Contains((value ?? \"\").Trim());","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use only true/false, 1/0, yes/no, or on/off for pivot style toggles.","Normalize upstream booleans to true/false before setting.","Reject abbreviations like 't'/'y' before they reach the parser."],"tags":["pivot-table","excel","input-validation","boolean","ooxml","officecli"],"backgroundTag":null,"analyzedSha":"1ced45e900782c5083ed550ddf328ee974e425e7","analyzedAt":"2026-08-13T13:01:07.193Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}