{"record":{"id":"d9096f5df7f4dce4","repo":"LykosAI/StabilityMatrix","slug":"height-must-be-a-positive-integer","errorCode":null,"errorMessage":"Height must be a positive integer","messagePattern":"Height must be a positive integer","errorType":"validation","errorClass":"DataValidationException","httpStatus":null,"severity":"warning","filePath":"StabilityMatrix.Avalonia/ViewModels/Settings/InferenceSettingsViewModel.cs","lineNumber":314,"sourceCode":"                {\n                    if (string.IsNullOrWhiteSpace(text))\n                        throw new DataValidationException(\"Width is required\");\n\n                    if (!int.TryParse(text, out var width) || width <= 0)\n                        throw new DataValidationException(\"Width must be a positive integer\");\n                },\n                Watermark = \"1024\",\n            },\n            new()\n            {\n                Label = \"Height\",\n                Validator = text =>\n                {\n                    if (string.IsNullOrWhiteSpace(text))\n                        throw new DataValidationException(\"Height is required\");\n\n                    if (!int.TryParse(text, out var height) || height <= 0)\n                        throw new DataValidationException(\"Height must be a positive integer\");\n                },\n                Watermark = \"1024\",\n            },\n        };\n\n        var dialog = DialogHelper.CreateTextEntryDialog(\"Add Favorite Dimensions\", \"\", textFields);\n\n        if (await dialog.ShowAsync() != ContentDialogResult.Primary)\n            return;\n\n        var width = textFields[0].Text;\n        var height = textFields[1].Text;\n\n        if (string.IsNullOrWhiteSpace(width) || string.IsNullOrWhiteSpace(height))\n            return;\n\n        FavoriteDimensions.Add($\"{width} x {height}\");\n    }","sourceCodeStart":296,"sourceCodeEnd":332,"githubUrl":"https://github.com/LykosAI/StabilityMatrix/blob/af93d6ef57c01cd890d7e0ad0a9ea8c9fcda3002/StabilityMatrix.Avalonia/ViewModels/Settings/InferenceSettingsViewModel.cs#L296-L332","documentation":"This DataValidationException is thrown by the Height field's Validator when the entered height is not a positive integer — either unparseable as an int or <= 0. It mirrors the Width validator at line 301.","triggerScenarios":"Entering 'abc', '768.5', '0', or a negative number into the Height field of the AddRow 'Add Favorite Dimensions' dialog.","commonSituations":"Copy-paste errors including units ('1024px'), decimals from aspect-ratio calculators, or negative values from formulas.","solutions":["Enter a positive whole number such as 1024 in the Height field","Strip units or decimals from pasted values","Use whole pixels as required by the underlying generation APIs"],"exampleFix":"// before\nvar heightText = \"1024px\";\n// after\nvar heightText = \"1024\";","handlingStrategy":"validation","validationCode":"bool isValidHeight(string s) => int.TryParse(s, out var h) && h > 0;","typeGuard":"bool IsValidDimension(string s) => int.TryParse(s, out var v) && v > 0;","tryCatchPattern":"try { dialog.SaveDimensions(); } catch (DataValidationException ex) { ShowFieldError(\"Height\", ex.Message); }","preventionTips":["Strip units like 'px' from pasted values","Round fractional sizes to whole integers","Use values within your generation backend's supported range"],"tags":["validation","user-input","csharp"],"backgroundTag":"invalid-argument-value","analyzedSha":"af93d6ef57c01cd890d7e0ad0a9ea8c9fcda3002","analyzedAt":"2026-09-12T19:02:43.389Z","contentChangedAt":"2026-09-12T19:02:43.389Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}