LykosAI/StabilityMatrix · warning · DataValidationException
Width must be a positive integer
Error message
Width must be a positive integer
What it means
This DataValidationException is thrown by the Width field's Validator in the 'Add Favorite Dimensions' text-entry dialog in InferenceSettingsViewModel. The library throws it because the entered width is either not parseable as an integer or is <= 0; only positive integers are accepted for image dimensions.
Solutions
- Enter a positive whole number such as 1024 in the Width field
- If the value came from another tool, round it to a whole integer
- Do not leave the field blank; 'Width is required' covers empty input
Example fix
// before var widthText = "-512"; // after var widthText = "512"; // positive integer only
Defensive patterns
Strategy: validation
Validate before calling
bool isValidWidth(string s) => int.TryParse(s, out var w) && w > 0;
Type guard
bool IsValidDimension(string s) => int.TryParse(s, out var v) && v > 0;
Try / catch
try { dialog.SaveDimensions(); } catch (DataValidationException ex) { ShowFieldError("Width", ex.Message); } Prevention
- Always enter whole positive pixel values
- Do not paste values with units or decimals
- Fill both Width and Height fields
When it happens
Trigger: User opens AddRow's 'Add Favorite Dimensions' dialog and types a non-numeric string (e.g. 'abc', '10.5') or a zero/negative number (e.g. '0', '-512') into the Width field.
Common situations: Pasting a dimension pair into the wrong field, typing fractional sizes copied from other tools, entering 0 intending 'default'.
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
- Height 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/f305e99421cc11dd.
Report an issue: GitHub.
Appendix: source
Thrown at StabilityMatrix.Avalonia/ViewModels/Settings/InferenceSettingsViewModel.cs:301
);
}
[RelayCommand]
private async Task AddRow()
{
// FavoriteDimensions.Add(string.Empty);
var textFields = new TextBoxField[]
{
new()
{
Label = "Width",
Validator = text =>
{
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",
},
};
View on GitHub (pinned to af93d6ef57)