LykosAI/StabilityMatrix · warning · DataValidationException
File name is required
Error message
File name is required
What it means
In CheckpointFileViewModel.RenameAsync, the rename dialog's Validator throws DataValidationException("File name is required") when the user submits an empty or whitespace-only name. The dialog blocks the rename until a valid non-empty name is entered.
Solutions
- Type a non-empty file name (including its extension) in the dialog and confirm
- Cancel the dialog if you did not intend to rename
- If triggered programmatically, pass the existing CheckpointFile.FileName as the default Text so empty submissions cannot occur
Example fix
// before
Text = CheckpointFile.FileName, // user may clear it
// after
Text = CheckpointFile.FileName,
Validator = text =>
{
if (string.IsNullOrWhiteSpace(text))
throw new DataValidationException("File name is required");
if (!Path.HasExtension(text) && Path.HasExtension(CheckpointFile.FileName))
text = text + Path.GetExtension(CheckpointFile.FileName); // preserve extension
if (File.Exists(Path.Combine(parentPath, text)))
throw new DataValidationException("File name already exists");
} Defensive patterns
Strategy: validation
Validate before calling
// Validate before confirming the rename
if (string.IsNullOrWhiteSpace(newName))
throw new DataValidationException("File name is required"); Type guard
bool IsValidFileName(string? name) =>
!string.IsNullOrWhiteSpace(name) && name.IndexOfAny(Path.GetInvalidFileNameChars()) < 0; Try / catch
try
{
await checkpointFileVm.RenameAsync();
}
catch (DataValidationException ex) when (ex.Message == "File name is required")
{
// Dialog already surfaces this; log for telemetry only
Logger.Debug("Rename aborted: empty file name");
} Prevention
- Always pre-fill the rename dialog with the current file name (Text = CheckpointFile.FileName)
- Keep the extension when typing a new name
- Do not clear the input field before confirming
- Cancel the dialog if no rename is intended
When it happens
Trigger: Submitting the 'Rename Model' text-entry dialog (launched from RenameAsync on a CheckpointFileViewModel) with an empty string or only whitespace in the 'File name' field.
Common situations: Pressing Enter/clicking OK without typing a name; accidentally clearing the pre-filled Text (CheckpointFile.FileName) before confirming.
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
- File name already exists
- Resources.Validation_PackageNameCannotBeEmpty
- Name is required
- Pack already exists
- Length cannot be null when latentType is Hunyuan
AI-assisted analysis of LykosAI/StabilityMatrix@af93d6ef57 (2026-09-12).
Data as JSON: /api/errors/b7bfff72289d7058.
Report an issue: GitHub.
Appendix: source
Thrown at StabilityMatrix.Avalonia/ViewModels/CheckpointManager/CheckpointFileViewModel.cs:350
await modelIndexService.RemoveModelAsync(CheckpointFile);
}
[RelayCommand]
private async Task RenameAsync()
{
// Parent folder path
var parentPath =
Path.GetDirectoryName((string?)CheckpointFile.GetFullPath(settingsManager.ModelsDirectory)) ?? "";
var textFields = new TextBoxField[]
{
new()
{
Label = "File name",
Validator = text =>
{
if (string.IsNullOrWhiteSpace(text))
throw new DataValidationException("File name is required");
if (File.Exists(Path.Combine(parentPath, text)))
throw new DataValidationException("File name already exists");
},
Text = CheckpointFile.FileName,
},
};
var dialog = DialogHelper.CreateTextEntryDialog("Rename Model", "", textFields);
if (await dialog.ShowAsync() == ContentDialogResult.Primary)
{
var name = textFields[0].Text;
var nameNoExt = Path.GetFileNameWithoutExtension(name);
var originalNameNoExt = Path.GetFileNameWithoutExtension(CheckpointFile.FileName);
// Rename file in OS
try
{View on GitHub (pinned to af93d6ef57)