{"record":{"id":"2fb121b0f0a1e396","repo":"iOfficeAI/OfficeCLI","slug":"invalid-logbase-value-must-be-in-the-ooxml-ra","errorCode":null,"errorMessage":"Invalid logBase '{value}': must be in the OOXML range [2, 1000] (ST_LogBase).","messagePattern":"Invalid logBase '(.+?)': must be in the OOXML range \\[2, 1000\\] \\(ST_LogBase\\)\\.","errorType":"validation","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/officecli/Core/Chart/ChartHelper.Axis.cs","lineNumber":493,"sourceCode":"                            }\n                            else if (value.Equals(\"none\", StringComparison.OrdinalIgnoreCase) ||\n                                     value.Equals(\"linear\", StringComparison.OrdinalIgnoreCase) ||\n                                     value.Equals(\"false\", StringComparison.OrdinalIgnoreCase) ||\n                                     value.Equals(\"no\", StringComparison.OrdinalIgnoreCase))\n                            {\n                                newLogBase = null; // remove log scale (linear)\n                            }\n                            else\n                            // \"0\" dropped as a falsy synonym for the same\n                            // reason as the Setter.cs site — falls into the\n                            // range check below and throws.\n                            {\n                                var logVal = ParseHelpers.SafeParseDouble(value, \"logBase\");\n                                // ST_LogBase: minInclusive=2.0, maxInclusive=1000.0 — reject\n                                // out-of-band values so Excel doesn't silently\n                                // ghost-rewrite the chart back to linear.\n                                if (logVal < 2.0 || logVal > 1000.0)\n                                    throw new ArgumentException($\"Invalid logBase '{value}': must be in the OOXML range [2, 1000] (ST_LogBase).\");\n                                newLogBase = logVal;\n                            }\n                            // A log scale requires axis min > 0 (Excel refuses\n                            // the file, 0x800A03EC).\n                            if (newLogBase != null\n                                && scaling.GetFirstChild<C.MinAxisValue>()?.Val?.Value is { } curMin && curMin <= 0)\n                                throw new ArgumentException(\n                                    $\"logBase cannot be enabled while the axis minimum ({curMin}) is <= 0: a logarithmic axis minimum must be greater than 0.\");\n                            scaling.RemoveAllChildren<C.LogBase>();\n                            if (newLogBase != null)\n                                scaling.PrependChild(new C.LogBase { Val = newLogBase.Value });\n                        }\n                    }\n                    directlyHandled.Add(key);\n                    break;\n                }\n\n                case \"format\":","sourceCodeStart":475,"sourceCodeEnd":511,"githubUrl":"https://github.com/iOfficeAI/OfficeCLI/blob/1ced45e900782c5083ed550ddf328ee974e425e7/src/officecli/Core/Chart/ChartHelper.Axis.cs#L475-L511","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","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."],"exampleFix":"// before\nlogbase=1\n// after\nlogbase=10\n// to disable\nlogbase=false","handlingStrategy":"validation","validationCode":"static bool IsLogBaseInRange(string value)\n{\n    if (!double.TryParse(value, System.Globalization.NumberStyles.Float,\n        System.Globalization.CultureInfo.InvariantCulture, out var logVal))\n        return false;\n    return logVal >= 2.0 && logVal <= 1000.0;\n}","typeGuard":null,"tryCatchPattern":"try { axisSetter.Apply(\"logbase\", value); }\ncatch (ArgumentException ex) when (ex.Message.StartsWith(\"Invalid logBase\"))\n{\n    Console.Error.WriteLine($\"{ex.Message}\\nValid range: [2, 1000]. Use logbase=false to disable.\");\n}","preventionTips":["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."],"tags":["chart","axis","log-scale","range-check","ooxml-schema"],"backgroundTag":null,"analyzedSha":"1ced45e900782c5083ed550ddf328ee974e425e7","analyzedAt":"2026-08-13T13:01:07.193Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}