{"record":{"id":"6f99cc4507fada86","repo":"iOfficeAI/OfficeCLI","slug":"unknown-validation-type-dvtype-use-list-whol","errorCode":null,"errorMessage":"Unknown validation type: {dvType}. Use: list, whole, decimal, date, time, textLength, custom","messagePattern":"Unknown validation type: (.+?)\\. Use: list, whole, decimal, date, time, textLength, custom","errorType":"validation","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/officecli/Handlers/Excel/ExcelHandler.Add.Tables.cs","lineNumber":542,"sourceCode":"\n        var dv = new DataValidation\n        {\n            SequenceOfReferences = new ListValue<StringValue>(\n                dvSqref.Split(' ').Select(s => new StringValue(s)))\n        };\n\n        if (properties.TryGetValue(\"type\", out var dvType))\n        {\n            dv.Type = dvType.ToLowerInvariant() switch\n            {\n                \"list\" => DataValidationValues.List,\n                \"whole\" => DataValidationValues.Whole,\n                \"decimal\" => DataValidationValues.Decimal,\n                \"date\" => DataValidationValues.Date,\n                \"time\" => DataValidationValues.Time,\n                \"textlength\" => DataValidationValues.TextLength,\n                \"custom\" => DataValidationValues.Custom,\n                _ => throw new ArgumentException($\"Unknown validation type: {dvType}. Use: list, whole, decimal, date, time, textLength, custom\")\n            };\n        }\n\n        if (properties.TryGetValue(\"operator\", out var dvOp))\n        {\n            dv.Operator = dvOp.ToLowerInvariant() switch\n            {\n                \"between\" => DataValidationOperatorValues.Between,\n                \"notbetween\" => DataValidationOperatorValues.NotBetween,\n                \"equal\" => DataValidationOperatorValues.Equal,\n                \"notequal\" => DataValidationOperatorValues.NotEqual,\n                \"greaterthan\" => DataValidationOperatorValues.GreaterThan,\n                \"lessthan\" => DataValidationOperatorValues.LessThan,\n                \"greaterthanorequal\" => DataValidationOperatorValues.GreaterThanOrEqual,\n                \"lessthanorequal\" => DataValidationOperatorValues.LessThanOrEqual,\n                _ => throw new ArgumentException($\"Unknown operator: {dvOp}\")\n            };\n        }","sourceCodeStart":524,"sourceCodeEnd":560,"githubUrl":"https://github.com/iOfficeAI/OfficeCLI/blob/1ced45e900782c5083ed550ddf328ee974e425e7/src/officecli/Handlers/Excel/ExcelHandler.Add.Tables.cs#L524-L560","documentation":"Thrown by AddValidation when the optional \"type\" property is present but its lower-cased value is not one of list, whole, decimal, date, time, textlength, custom. These map 1:1 to DataValidationValues; anything else is rejected rather than silently defaulting.","triggerScenarios":"Call Add type \"validation\" with properties[\"type\"] set to a value outside the enumerated set (e.g. \"integer\", \"numeric\", \"whole number\", \"Text\").","commonSituations":"Using the Excel-UI label ('Whole number') instead of the token; expecting 'integer' as a synonym for 'whole'; typos; trailing whitespace.","solutions":["Use one of: list, whole, decimal, date, time, textLength, custom (case-insensitive, textLength is one word).","For whole numbers use \"whole\"; for fractions use \"decimal\".","Validate the value against the allowed set before calling."],"exampleFix":"// before\nhandler.Add(\"/Sheet1\", \"validation\", null,\n    new() { [\"sqref\"] = \"A1:A5\", [\"type\"] = \"integer\" });\n// after\nhandler.Add(\"/Sheet1\", \"validation\", null,\n    new() { [\"sqref\"] = \"A1:A5\", [\"type\"] = \"whole\" });","handlingStrategy":"type-guard","validationCode":"static readonly HashSet<string> DvTypes = new(StringComparer.OrdinalIgnoreCase)\n    { \"list\", \"whole\", \"decimal\", \"date\", \"time\", \"textlength\", \"custom\" };\nif (properties.TryGetValue(\"type\", out var t) && !DvTypes.Contains(t))\n    throw new ArgumentOutOfRangeException($\"bad validation type '{t}'\");","typeGuard":"static bool IsValidValidationType(string? t) =>\n    t is not null && (new[] { \"list\", \"whole\", \"decimal\", \"date\", \"time\", \"textlength\", \"custom\" })\n        .Contains(t, StringComparer.OrdinalIgnoreCase);","tryCatchPattern":null,"preventionTips":["Map Excel-UI labels to tokens before calling (e.g. 'Whole number' -> whole).","Use whole for integers, decimal for fractions.","Remember textLength is one word, case-insensitive."],"tags":["excel","validation","enum","type-validation"],"backgroundTag":null,"analyzedSha":"1ced45e900782c5083ed550ddf328ee974e425e7","analyzedAt":"2026-08-13T13:01:07.193Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}