{"record":{"id":"cc759cc17628492b","repo":"iOfficeAI/OfficeCLI","slug":"invalid-crosses-value-value-valid-autozer","errorCode":null,"errorMessage":"Invalid 'crosses' value: '{value}'. Valid: autoZero, max, min.","messagePattern":"Invalid 'crosses' value: '(.+?)'\\. Valid: autoZero, max, min\\.","errorType":"validation","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/officecli/Core/Chart/ChartHelper.Axis.cs","lineNumber":326,"sourceCode":"                    }\n                    else\n                    {\n                        translated[\"axismax\"] = value;\n                    }\n                    break;\n\n                case \"crosses\":\n                    if (normalizedRole == \"value2\" && targetAxis is OpenXmlCompositeElement crsAx2)\n                    {\n                        // Same-type only — see ChartHelper.Setter.cs case \"crosses\"\n                        // for the mutual-remove bug rationale.\n                        // Validate BEFORE mutating (atomicity).\n                        var crossVal = value.ToLowerInvariant() switch\n                        {\n                            \"max\" => C.CrossesValues.Maximum,\n                            \"min\" => C.CrossesValues.Minimum,\n                            \"autozero\" => C.CrossesValues.AutoZero,\n                            _ => throw new ArgumentException($\"Invalid 'crosses' value: '{value}'. Valid: autoZero, max, min.\")\n                        };\n                        crsAx2.RemoveAllChildren<C.Crosses>();\n                        var newCrosses = new C.Crosses { Val = crossVal };\n                        var crsAnchor = crsAx2.GetFirstChild<C.CrossesAt>() as OpenXmlElement\n                            ?? crsAx2.GetFirstChild<C.CrossBetween>() as OpenXmlElement;\n                        if (crsAnchor != null) crsAx2.InsertBefore(newCrosses, crsAnchor);\n                        else crsAx2.AppendChild(newCrosses);\n                        directlyHandled.Add(key);\n                    }\n                    else\n                    {\n                        translated[\"crosses\"] = value;\n                    }\n                    break;\n\n                case \"crossesat\":\n                    if (normalizedRole == \"value2\" && targetAxis is OpenXmlCompositeElement crsAtAx2)\n                    {","sourceCodeStart":308,"sourceCodeEnd":344,"githubUrl":"https://github.com/iOfficeAI/OfficeCLI/blob/1ced45e900782c5083ed550ddf328ee974e425e7/src/officecli/Core/Chart/ChartHelper.Axis.cs#L308-L344","documentation":"The 'crosses' setter for the secondary value axis (value2 role) accepts only three OOXML C.CrossesValues: autoZero, max, min. The value is lowercased and matched; any other string throws. Validation occurs BEFORE the C.Crosses element is mutated, ensuring atomicity on bad input.","triggerScenarios":"Setting crosses[value2] to an unrecognized value like 'middle', 'center', 'top', 'bottom', or 'none'. Only applies to the value2 role with a concrete OpenXmlCompositeElement axis target.","commonSituations":"Typing 'auto' instead of 'autoZero'. Using a value valid for a different axis property (e.g. 'next' from CrossesValues.Next, which the library intentionally does not expose). Expecting positional terms like 'top' or 'center' that have no OOXML equivalent.","solutions":["Use autoZero, max, or min: crosses[value2]=max.","For the default crossing behavior, use autoZero.","Note: this path only applies to the value2 role — the primary axis crosses setter is in ChartHelper.Setter.cs."],"exampleFix":"// before\ncrosses[value2]=center\n// after\ncrosses[value2]=max\n// or\ncrosses[value2]=autozero","handlingStrategy":"validation","validationCode":"static readonly HashSet<string> ValidCrossesValues = new(StringComparer.OrdinalIgnoreCase)\n{ \"autozero\", \"max\", \"min\" };\n\nstatic bool IsValidCrossesValue(string value) => ValidCrossesValues.Contains(value);","typeGuard":null,"tryCatchPattern":"try { axisSetter.Apply(\"crosses\", value); }\ncatch (ArgumentException ex) when (ex.Message.StartsWith(\"Invalid 'crosses' value\"))\n{\n    Console.Error.WriteLine($\"{ex.Message}\\nValid: autoZero, max, min.\");\n}","preventionTips":["Use only autoZero, max, or min for the crosses property.","Validate against the allowed set before passing user input.","Note that this path only applies to the value2 (secondary) axis role."],"tags":["chart","axis","crosses","invalid-value"],"backgroundTag":null,"analyzedSha":"1ced45e900782c5083ed550ddf328ee974e425e7","analyzedAt":"2026-08-13T13:01:07.193Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}