LykosAI/StabilityMatrix · warning · DataValidationException
Width is required
Error message
Width is required
What it means
AddRow in InferenceSettingsViewModel shows a text-entry dialog for a new inference row whose 'Width' field validator throws DataValidationException('Width is required') when the input is null or whitespace. It ensures a width value is supplied before the companion positive-integer check runs.
Solutions
- Enter a positive integer width (e.g. 1024) in the field before confirming.
- Use digits only; the follow-up check rejects zero, negatives, and non-numeric text.
- If adding rows programmatically, pass a pre-validated integer-as-string.
Example fix
// before
if (string.IsNullOrWhiteSpace(text)) throw new DataValidationException("Width is required");
// after
var trimmed = text?.Trim();
if (string.IsNullOrEmpty(trimmed)) throw new DataValidationException("Width is required");
if (!int.TryParse(trimmed, out var width) || width <= 0)
throw new DataValidationException("Width must be a positive integer"); Defensive patterns
Strategy: validation
Validate before calling
bool IsValidWidth(string? s) =>
int.TryParse(s?.Trim(), out var w) && w > 0;
// only submit the dialog when IsValidWidth(widthText) Type guard
bool TryParsePositiveInt(string? s, out int value) =>
int.TryParse(s?.Trim(), out value) && value > 0; Try / catch
try { await viewModel.AddRow(); }
catch (DataValidationException ex) { SetFieldError(ex.Message); } Prevention
- Enter a positive integer in the Width field before confirming.
- Use numeric-only input (the watermark suggests 1024).
- Keep OK disabled until both width and any companion fields validate.
When it happens
Trigger: Submitting the Add Row dialog (InferenceSettingsViewModel.cs:298) leaving the Width field empty or whitespace-only.
Common situations: Clicking OK without typing a value; clearing the field intending to cancel; paste of whitespace; typing non-numeric text which triggers the sibling 'Width must be a positive integer' error instead.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- URL is required
- Invalid URL format
- Name is required
- Length cannot be null when latentType is Hunyuan
- Invalid Token
AI-assisted analysis of LykosAI/StabilityMatrix@af93d6ef57 (2026-09-12).
Data as JSON: /api/errors/9357777b10180fcf.
Report an issue: GitHub.
Appendix: source
Thrown at StabilityMatrix.Avalonia/ViewModels/Settings/InferenceSettingsViewModel.cs:298
$"Imported {sourceFile.Name}",
$"The {sourceFile.Name} file has been imported.",
NotificationType.Success
);
}
[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)