{"record":{"id":"cd794a15bf10fd46","repo":"spectreconsole/spectre.console","slug":"minimum-size-must-be-equal-to-or-greater-than-1","errorCode":null,"errorMessage":"Minimum size must be equal to or greater than 1","messagePattern":"Minimum size must be equal to or greater than 1","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Spectre.Console/Widgets/Layout/Layout.cs","lineNumber":55,"sourceCode":"            _ratio = value;\n        }\n    }\n\n    /// <summary>\n    /// Gets or sets the minimum width.\n    /// </summary>\n    /// <remarks>\n    /// Defaults to <c>1</c>.\n    /// Must be greater than <c>0</c>.\n    /// </remarks>\n    public int MinimumSize\n    {\n        get => _minimumSize;\n        set\n        {\n            if (value < 1)\n            {\n                throw new InvalidOperationException(\"Minimum size must be equal to or greater than 1\");\n            }\n\n            _minimumSize = value;\n        }\n    }\n\n    /// <summary>\n    /// Gets or sets the width.\n    /// </summary>\n    /// <remarks>\n    /// Defaults to <c>null</c>.\n    /// Must be greater than <c>0</c>.\n    /// </remarks>\n    public int? Size\n    {\n        get => _size;\n        set\n        {","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/spectreconsole/spectre.console/blob/0acc92fada6c42f13984e79c2b5f3d993bdfb099/src/Spectre.Console/Widgets/Layout/Layout.cs#L37-L73","documentation":"Thrown by the Layout.MinimumSize setter when value is less than 1. MinimumSize sets a lower bound on the rendered width and must be positive.","triggerScenarios":"Assigning MinimumSize a value of 0 or a negative number.","commonSituations":"Setting MinimumSize to 0 to mean 'no minimum' (the library does not support that; leave the default), or computing it from a measurement that yields 0.","solutions":["Set MinimumSize to a positive integer >= 1.","Omit setting MinimumSize to keep the default of 1 when no explicit minimum is needed.","Guard computed values with Math.Max(1, value)."],"exampleFix":"// before\nlayout.MinimumSize = measuredMin; // could be 0\n\n// after\nlayout.MinimumSize = Math.Max(1, measuredMin);","handlingStrategy":"validation","validationCode":"if (value < 1) throw new ArgumentOutOfRangeException(nameof(value), \"MinimumSize must be >= 1\");\nlayout.MinimumSize = value;","typeGuard":"static bool IsValidMinimumSize(int value) => value >= 1;","tryCatchPattern":null,"preventionTips":["Leave MinimumSize at default (1) when no explicit minimum is needed.","Do not use 0 to mean 'no minimum'."],"tags":["layout","invalid-operation","property-validation","spectre-console"],"backgroundTag":null,"analyzedSha":"0acc92fada6c42f13984e79c2b5f3d993bdfb099","analyzedAt":"2026-08-13T18:27:21.983Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}