LykosAI/StabilityMatrix · warning · DataValidationException
Height must be a positive integer
Error message
Height must be a positive integer
What it means
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.
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
Example fix
// before var heightText = "1024px"; // after var heightText = "1024";
Defensive patterns
Strategy: validation
Validate before calling
bool isValidHeight(string s) => int.TryParse(s, out var h) && h > 0;
Type guard
bool IsValidDimension(string s) => int.TryParse(s, out var v) && v > 0;
Try / catch
try { dialog.SaveDimensions(); } catch (DataValidationException ex) { ShowFieldError("Height", ex.Message); } Prevention
- Strip units like 'px' from pasted values
- Round fractional sizes to whole integers
- Use values within your generation backend's supported range
When it happens
Trigger: Entering 'abc', '768.5', '0', or a negative number into the Height field of the AddRow 'Add Favorite Dimensions' dialog.
Common situations: Copy-paste errors including units ('1024px'), decimals from aspect-ratio calculators, or negative values from formulas.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- Height is required
- Width must be a positive integer
- Fields line not found
- Resources.Validation_PackageNameCannotBeEmpty
- Sampler not selected
AI-assisted analysis of LykosAI/StabilityMatrix@af93d6ef57 (2026-09-12).
Data as JSON: /api/errors/d9096f5df7f4dce4.
Report an issue: GitHub.
Appendix: source
Thrown at StabilityMatrix.Avalonia/ViewModels/Settings/InferenceSettingsViewModel.cs:314
{
if (string.IsNullOrWhiteSpace(text))
throw new DataValidationException("Width is required");
if (!int.TryParse(text, out var width) || width <= 0)
throw new DataValidationException("Width must be a positive integer");
},
Watermark = "1024",
},
new()
{
Label = "Height",
Validator = text =>
{
if (string.IsNullOrWhiteSpace(text))
throw new DataValidationException("Height is required");
if (!int.TryParse(text, out var height) || height <= 0)
throw new DataValidationException("Height must be a positive integer");
},
Watermark = "1024",
},
};
var dialog = DialogHelper.CreateTextEntryDialog("Add Favorite Dimensions", "", textFields);
if (await dialog.ShowAsync() != ContentDialogResult.Primary)
return;
var width = textFields[0].Text;
var height = textFields[1].Text;
if (string.IsNullOrWhiteSpace(width) || string.IsNullOrWhiteSpace(height))
return;
FavoriteDimensions.Add($"{width} x {height}");
}View on GitHub (pinned to af93d6ef57)