{"record":{"id":"bbe46c790c65c75b","repo":"iOfficeAI/OfficeCLI","slug":"invalid-propertyname-value-value-expected-bbe46c","errorCode":null,"errorMessage":"Invalid '{propertyName}' value '{value}'. Expected a non-negative integer.","messagePattern":"Invalid '(.+?)' value '(.+?)'\\. Expected a non-negative integer\\.","errorType":"validation","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/officecli/Core/ParseHelpers.cs","lineNumber":532,"sourceCode":"    /// (e.g. 99999° wraps to a garbage 1.7e9 angle that real Excel refuses\n    /// with 0x800A03EC). Reducing modulo 360 first keeps the value in the\n    /// spec range [0, 21600000) — geometrically identical, overflow-proof,\n    /// and always producing a file Excel accepts. Shared by the shape and\n    /// chart gradient builders so their angle handling stays consistent.\n    /// </summary>\n    public static int GradientAngleToOoxmlUnits(int degrees)\n    {\n        var normalized = ((degrees % 360) + 360) % 360;\n        return normalized * 60000;\n    }\n\n    /// <summary>\n    /// Safely parse a string as uint, throwing ArgumentException with a clear message on failure.\n    /// </summary>\n    public static uint SafeParseUint(string value, string propertyName)\n    {\n        if (!uint.TryParse(value, CultureInfo.InvariantCulture, out var result))\n            throw new ArgumentException($\"Invalid '{propertyName}' value '{value}'. Expected a non-negative integer.\");\n        return result;\n    }\n\n    /// <summary>\n    /// Safely parse a string as byte, throwing ArgumentException with a clear message on failure.\n    /// </summary>\n    public static byte SafeParseByte(string value, string propertyName)\n    {\n        if (!byte.TryParse(value, CultureInfo.InvariantCulture, out var result))\n            throw new ArgumentException($\"Invalid '{propertyName}' value '{value}'. Expected an integer (0-255).\");\n        return result;\n    }\n\n    /// <summary>\n    /// Normalize a hex color string to 8-char ARGB format (e.g. \"FFFF0000\").\n    /// Accepts: \"FF0000\" (6-char RGB → prepend FF), \"#FF0000\" (strip #), \"F00\" (3-char → expand),\n    /// \"80FF0000\" (8-char ARGB → as-is). Always returns uppercase.\n    /// </summary>","sourceCodeStart":514,"sourceCodeEnd":550,"githubUrl":"https://github.com/iOfficeAI/OfficeCLI/blob/1ced45e900782c5083ed550ddf328ee974e425e7/src/officecli/Core/ParseHelpers.cs#L514-L550","documentation":"Thrown by ParseHelpers.SafeParseUint when the value is not a valid non-negative uint (culture-invariant parse). Rejects negatives, non-integers, decimals, locale grouping, and any non-numeric text. Used for properties that must be whole non-negative counts: Excel rotation/indent/zoom/paperSize/padding/width and calc.iterateCount.","triggerScenarios":"Passing a negative number, a decimal ('1.5'), a percent/unit suffix, or text to any uint property: rotation, indent, zoom, paperSize, padding, width, calc.iterateCount.","commonSituations":"Passing 'auto' to a width/padding field whose caller did not pre-handle it (some width paths special-case 'auto' before calling SafeParseUint); passing '-10' for indent/rotation; passing '120%' for zoom with '%' still attached; passing a decimal font/size value where a uint is required.","solutions":["Supply a whole, non-negative integer with no units, e.g. zoom=\"120\".","Strip '%' or other suffixes before the value reaches the parser (zoom paths expect a plain int).","For Excel text rotation use 0-180; negative or >180 are invalid here (this is the Excel uint rotation, distinct from PPT degrees)."],"exampleFix":"// before\nzoom=\"120%\"\n// after\nzoom=\"120\"","handlingStrategy":"validation","validationCode":"static bool IsNonNegativeInt(string value)\n    => uint.TryParse(value, System.Globalization.CultureInfo.InvariantCulture, out _);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pass whole non-negative integers with no units for uint fields.","Strip '%' and other suffixes before the value reaches the parser.","Handle special tokens like 'auto' on width/padding BEFORE calling SafeParseUint."],"tags":["parsing","input-validation","numeric","uint","excel","officecli"],"backgroundTag":null,"analyzedSha":"1ced45e900782c5083ed550ddf328ee974e425e7","analyzedAt":"2026-08-13T13:01:07.193Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}