{"record":{"id":"061b34e28344dd16","repo":"iOfficeAI/OfficeCLI","slug":"logbase-cannot-be-enabled-while-the-axis-minimum","errorCode":null,"errorMessage":"logBase cannot be enabled while the axis minimum ({curMin}) is <= 0: a logarithmic axis minimum must be greater than 0.","messagePattern":"logBase cannot be enabled while the axis minimum \\((.+?)\\) is <= 0: a logarithmic axis minimum must be greater than 0\\.","errorType":"validation","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/officecli/Core/Chart/ChartHelper.Axis.cs","lineNumber":500,"sourceCode":"                            }\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\":\n                {\n                    // Number-format string written as the axis's NumberingFormat child.\n                    // Schema declares format on all roles; apply directly on the resolved axis.\n                    if (targetAxis is OpenXmlCompositeElement axNf)\n                    {\n                        axNf.RemoveAllChildren<C.NumberingFormat>();\n                        var nf = new C.NumberingFormat { FormatCode = value, SourceLinked = false };","sourceCodeStart":482,"sourceCodeEnd":518,"githubUrl":"https://github.com/iOfficeAI/OfficeCLI/blob/1ced45e900782c5083ed550ddf328ee974e425e7/src/officecli/Core/Chart/ChartHelper.Axis.cs#L482-L518","documentation":"When enabling a log scale (logBase is set to a valid value), the library checks the axis's existing MinAxisValue. A logarithmic axis with min <= 0 produces an invalid file that Excel refuses (0x800A03EC). This guard catches the case where min was set to 0 or negative BEFORE enabling log scale — the reverse of error 131 (which catches min set AFTER log scale).","triggerScenarios":"Setting axismin=0 (or any non-positive value) first, then setting logbase=10 on the same axis. The check reads scaling.GetFirstChild<C.MinAxisValue>()?.Val and verifies it is > 0 before applying the new LogBase.","commonSituations":"Starting with a default axis min of 0 (common for value axes) and then enabling log scale without first raising the min. Applying a preset configuration that sets min=0 and logbase together in the wrong order. Inheriting an axis with min=0 from a template chart.","solutions":["Set axismin to a positive value before or together with logbase: axismin=1 then logbase=10.","Remove the existing min constraint: the library will remove it if you clear MinAxisValue first.","Apply log scale and min in the correct order: raise min first, then enable log."],"exampleFix":"// before\naxismin=0\nlogbase=10\n// after\naxismin=1\nlogbase=10","handlingStrategy":"validation","validationCode":"static bool CanEnableLogBase(OpenXmlCompositeElement axis)\n{\n    var scaling = axis.GetFirstChild<C.Scaling>();\n    if (scaling?.GetFirstChild<C.MinAxisValue>()?.Val?.Value is { } curMin)\n        return curMin > 0;\n    return true; // no min constraint set\n}","typeGuard":null,"tryCatchPattern":"try { axisSetter.Apply(\"logbase\", value); }\ncatch (ArgumentException ex) when (ex.Message.Contains(\"logBase cannot be enabled\"))\n{\n    Console.Error.WriteLine($\"{ex.Message}\\nSet axismin to a positive value first.\");\n}","preventionTips":["Set axismin to a positive value before enabling log scale.","Remove any existing MinAxisValue <= 0 before applying logBase.","Apply min and log scale in the correct order: raise min first."],"tags":["chart","axis","log-scale","range-check","order-dependency"],"backgroundTag":null,"analyzedSha":"1ced45e900782c5083ed550ddf328ee974e425e7","analyzedAt":"2026-08-13T13:01:07.193Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}