iOfficeAI/OfficeCLI · error · ArgumentException
Invalid logBase '{value}': must be in the OOXML range [2, 10
Error message
Invalid logBase '{value}': must be in the OOXML range [2, 1000] (ST_LogBase). What it means
The logBase setter parses the value as a double and enforces the OOXML ST_LogBase constraint: logVal must be in [2.0, 1000.0]. Values outside this range produce a schema-invalid file that Excel may silently rewrite back to linear. The guard prevents this ghost-rewrite. Note: '0' and false are handled upstream as falsy synonyms for removing the log scale (setting linear), so they do not reach this check.
Source
Thrown at src/officecli/Core/Chart/ChartHelper.Axis.cs:493
}
else if (value.Equals("none", StringComparison.OrdinalIgnoreCase) ||
value.Equals("linear", StringComparison.OrdinalIgnoreCase) ||
value.Equals("false", StringComparison.OrdinalIgnoreCase) ||
value.Equals("no", StringComparison.OrdinalIgnoreCase))
{
newLogBase = null; // remove log scale (linear)
}
else
// "0" dropped as a falsy synonym for the same
// reason as the Setter.cs site — falls into the
// range check below and throws.
{
var logVal = ParseHelpers.SafeParseDouble(value, "logBase");
// ST_LogBase: minInclusive=2.0, maxInclusive=1000.0 — reject
// out-of-band values so Excel doesn't silently
// ghost-rewrite the chart back to linear.
if (logVal < 2.0 || logVal > 1000.0)
throw new ArgumentException($"Invalid logBase '{value}': must be in the OOXML range [2, 1000] (ST_LogBase).");
newLogBase = logVal;
}
// A log scale requires axis min > 0 (Excel refuses
// the file, 0x800A03EC).
if (newLogBase != null
&& scaling.GetFirstChild<C.MinAxisValue>()?.Val?.Value is { } curMin && curMin <= 0)
throw new ArgumentException(
$"logBase cannot be enabled while the axis minimum ({curMin}) is <= 0: a logarithmic axis minimum must be greater than 0.");
scaling.RemoveAllChildren<C.LogBase>();
if (newLogBase != null)
scaling.PrependChild(new C.LogBase { Val = newLogBase.Value });
}
}
directlyHandled.Add(key);
break;
}
case "format":View on GitHub (pinned to 1ced45e900)
Solutions
- Use a base in [2, 1000]: logbase=10 or logbase=2.
- To disable log scaling, use logbase=0, logbase=false, or logbase=none (intercepted before the range check).
- Common valid bases: 2 (binary), 10 (decimal), 100, 1000.
Example fix
// before logbase=1 // after logbase=10 // to disable logbase=false
Defensive patterns
Strategy: validation
Validate before calling
static bool IsLogBaseInRange(string value)
{
if (!double.TryParse(value, System.Globalization.NumberStyles.Float,
System.Globalization.CultureInfo.InvariantCulture, out var logVal))
return false;
return logVal >= 2.0 && logVal <= 1000.0;
} Try / catch
try { axisSetter.Apply("logbase", value); }
catch (ArgumentException ex) when (ex.Message.StartsWith("Invalid logBase"))
{
Console.Error.WriteLine($"{ex.Message}\nValid range: [2, 1000]. Use logbase=false to disable.");
} Prevention
- Keep logBase in the range 2–1000 (common: 2, 10, 100).
- Use logbase=false or logbase=0 to disable log scaling.
- Validate the numeric range before applying.
When it happens
Trigger: Setting logbase to a value < 2 or > 1000: logbase=1, logbase=0.5, logbase=5000. The value is parsed via SafeParseDouble before the range check.
Common situations: Using logbase=1 (log base 1 is mathematically undefined). Using logbase=10 and expecting it means 'scale by 10x' (it means logarithmic base 10, which is valid). Typing a percentage or multiplier instead of a base. Using logbase=0 expecting it to disable log scale (use 'false' or '0' which is intercepted upstream as falsy).
Related errors
- min={value} is invalid on a log-scaled axis: a logarithmic a
- logBase cannot be enabled while the axis minimum ({curMin})
- Invalid 'tickLabelSkip' value: '{value}'. Must be an integer
- Invalid {lower} '{value}': must be a positive number (OOXML
- axisMin={value} is invalid on a log-scaled axis: a logarithm
AI-assisted analysis of iOfficeAI/OfficeCLI@1ced45e900 (2026-08-13).
Data as JSON: /api/errors/2fb121b0f0a1e396.
Report an issue: GitHub.