iOfficeAI/OfficeCLI · error · ArgumentException
Invalid tick mark value '{value}'. Valid values: none, in, o
Error message
Invalid tick mark value '{value}'. Valid values: none, in, out, cross. What it means
Thrown by ParseTickMark (ChartHelper.SetterHelpers.cs:57) when a tick-mark string does not match none/false, in/inside, out/outside, or cross/both. Unlike legend parsing, this method only applies ToLowerInvariant (no SchemaKeyNormalizer), so separator variants and abbreviations are not normalized. The error lists the four canonical values in the message.
Source
Thrown at src/officecli/Core/Chart/ChartHelper.SetterHelpers.cs:57
"topright" or "tr" => C.LegendPositionValues.TopRight,
_ => throw new ArgumentException(
$"Invalid legend position '{value}'. " +
"Valid: none, top, bottom, left, right, topRight " +
"(or use 'none'/'false' to hide the legend)."),
};
}
// ==================== Tick Mark Helpers ====================
internal static C.TickMarkValues ParseTickMark(string value)
{
return value.ToLowerInvariant() switch
{
"none" or "false" => C.TickMarkValues.None,
"in" or "inside" => C.TickMarkValues.Inside,
"out" or "outside" => C.TickMarkValues.Outside,
"cross" or "both" => C.TickMarkValues.Cross,
_ => throw new ArgumentException(
$"Invalid tick mark value '{value}'. Valid values: none, in, out, cross.")
};
}
// ==================== Trendline Helpers ====================
internal static C.Trendline BuildTrendline(string spec)
{
// Format: "type" or "type:order" or "type:forward:backward"
// e.g. "linear", "poly:3", "exp:2:1", "movingAvg:3"
var parts = spec.Split(':');
var typeStr = parts[0].Trim().ToLowerInvariant();
var trendline = new C.Trendline();
var trendType = typeStr switch
{
"linear" => C.TrendlineValues.Linear,View on GitHub (pinned to 1ced45e900)
Solutions
- Use one of: none, in, out, cross (aliases: inside, outside, both, false).
- Do not rely on dash/underscore normalization for tick marks — pass the bare token.
Example fix
// before majorTickMark=inside-out // after majorTickMark=in
Defensive patterns
Strategy: validation
Validate before calling
static readonly Dictionary<string,string> TickMarks = new(StringComparer.OrdinalIgnoreCase)
{ ["none"]="none",["false"]="none",["in"]="in",["inside"]="in",["out"]="out",["outside"]="out",["cross"]="cross",["both"]="cross" };
static string ResolveTickMark(string v) => TickMarks.TryGetValue((v ?? "").Trim(), out var t) ? t : throw new ArgumentException($"invalid tick mark '{v}'"); Type guard
static bool IsValidTickMark(string v) => TickMarks.ContainsKey((v ?? "").Trim());
Try / catch
try { /* set chart majorTickMark=... */ }
catch (ArgumentException ex) when (ex.Message.Contains("Invalid tick mark value"))
{ /* list: none, in, out, cross */ } Prevention
- Tick marks are NOT separator-normalized — pass bare tokens (no dashes).
- Lowercase the value before setting.
- Map Excel UI 'Inside/Outside/Cross' to in/out/cross explicitly.
When it happens
Trigger: Setting a tick-mark property (e.g. majorTickMark, minorTickMark) to a token outside none/in/out/cross and their aliases, e.g. 'inside-out', 'full', 'middle', 'center', 'internal'.
Common situations: Translating Excel's 'Inside'/'Outside'/'Cross' UI wording but guessing a non-alias token like 'internal' or 'middle'; passing 'IN' works (lowercased) but 'in-out' does not since no separator normalization happens here.
Related errors
- min={value} is invalid on a log-scaled axis: a logarithmic a
- Invalid 'crosses' value: '{value}'. Valid: autoZero, max, mi
- Invalid logBase '{value}': must be in the OOXML range [2, 10
- logBase cannot be enabled while the axis minimum ({curMin})
- Invalid baseTimeUnit '{value}': expected days, months, or ye
AI-assisted analysis of iOfficeAI/OfficeCLI@1ced45e900 (2026-08-13).
Data as JSON: /api/errors/9d9617dc040b4882.
Report an issue: GitHub.