iOfficeAI/OfficeCLI · error · ArgumentException
Invalid '{propertyName}' value '{value}'. Expected an intege
Error message
Invalid '{propertyName}' value '{value}'. Expected an integer (0-255). What it means
Thrown by ParseHelpers.SafeParseByte when the value is not an integer in [0,255]. Culture-invariant parse; rejects negatives, values >255, decimals, and non-numeric text. Used for byte-sized properties such as chart series marker size.
Source
Thrown at src/officecli/Core/ParseHelpers.cs:542
}
/// <summary>
/// Safely parse a string as uint, throwing ArgumentException with a clear message on failure.
/// </summary>
public static uint SafeParseUint(string value, string propertyName)
{
if (!uint.TryParse(value, CultureInfo.InvariantCulture, out var result))
throw new ArgumentException($"Invalid '{propertyName}' value '{value}'. Expected a non-negative integer.");
return result;
}
/// <summary>
/// Safely parse a string as byte, throwing ArgumentException with a clear message on failure.
/// </summary>
public static byte SafeParseByte(string value, string propertyName)
{
if (!byte.TryParse(value, CultureInfo.InvariantCulture, out var result))
throw new ArgumentException($"Invalid '{propertyName}' value '{value}'. Expected an integer (0-255).");
return result;
}
/// <summary>
/// Normalize a hex color string to 8-char ARGB format (e.g. "FFFF0000").
/// Accepts: "FF0000" (6-char RGB → prepend FF), "#FF0000" (strip #), "F00" (3-char → expand),
/// "80FF0000" (8-char ARGB → as-is). Always returns uppercase.
/// </summary>
public static string NormalizeArgbColor(string value)
{
// CONSISTENCY(color-input-whitespace): outer trim BEFORE any
// hash-strip / hex inspection so " #FF0000 " / " red " / "FF0000\n"
// (CLI pipes, JSON envelopes, copy-paste) parse the same as the bare
// value. Inner whitespace ("#FF 0000") remains invalid.
var trimmedInput = value.Trim();
// Try named color / rgb()/rgba()/hsl()/hsla() first
var resolved = TryResolveColorInput(trimmedInput);View on GitHub (pinned to 1ced45e900)
Solutions
- Clamp the marker size to the 0-255 integer range, e.g. markersize="10".
- Ensure the value is a whole number, not a decimal or a percent.
- If you need a larger visual size, scale via the chart's overall size rather than the byte markerSize field.
Example fix
// before series.markerSize="300" // after series.markerSize="255"
Defensive patterns
Strategy: validation
Validate before calling
static bool IsByte(string value)
=> byte.TryParse(value, System.Globalization.CultureInfo.InvariantCulture, out _); Prevention
- Clamp marker/byte sizes to 0-255 integers.
- Do not pass decimals or percentages to byte fields.
- Distinguish byte markerSize from double line width.
When it happens
Trigger: Passing series.markerSize / markersize with a value outside 0-255, a decimal, a negative, or non-numeric text. Callers: ChartHelper.SetterHelpers (series.markerSize) and ChartHelper.Setter (markersize).
Common situations: Passing a marker size derived from points/EMUs without clamping; passing '300' or '-1'; passing a percentage; confusing marker size with line width (which is a double).
Related errors
- Invalid '{propertyName}' value '{value}'. Expected a finite
- Invalid '{propertyName}' value '{value}'. Expected a non-neg
- Invalid color value: '{value}'. Expected 6-digit hex RGB (e.
- Invalid range '{spec}': end ({end}) must be >= start ({start
- Invalid range '{spec}'. Expected one or more 'start:end' ran
AI-assisted analysis of iOfficeAI/OfficeCLI@1ced45e900 (2026-08-13).
Data as JSON: /api/errors/c1134aeb1cabc8bf.
Report an issue: GitHub.