{"record":{"id":"ac8eae75e1f90aba","repo":"LykosAI/StabilityMatrix","slug":"url-is-required","errorCode":null,"errorMessage":"URL is required","messagePattern":"URL is required","errorType":"validation","errorClass":"DataValidationException","httpStatus":null,"severity":"warning","filePath":"StabilityMatrix.Avalonia/ViewModels/PackageManager/PackageExtensionBrowserViewModel.cs","lineNumber":702,"sourceCode":"    [RelayCommand]\n    private void SelectAllInstalledExtensions()\n    {\n        foreach (var item in InstalledItemsSearchCollection.FilteredItems)\n        {\n            item.IsSelected = true;\n        }\n    }\n\n    [RelayCommand]\n    private async Task InstallExtensionManualAsync()\n    {\n        var textField = new TextBoxField\n        {\n            Label = \"Extension URL\",\n            Validator = text =>\n            {\n                if (string.IsNullOrWhiteSpace(text))\n                    throw new DataValidationException(\"URL is required\");\n\n                if (!Uri.TryCreate(text, UriKind.Absolute, out _))\n                    throw new DataValidationException(\"Invalid URL format\");\n            },\n        };\n        var dialog = DialogHelper.CreateTextEntryDialog(\"Manual Extension Install\", \"\", [textField]);\n\n        if (await dialog.ShowAsync() != ContentDialogResult.Primary)\n            return;\n\n        var url = textField.Text.Trim();\n        if (string.IsNullOrWhiteSpace(url))\n            return;\n\n        if (\n            !Uri.TryCreate(url, UriKind.Absolute, out var uri)\n            || !uri.Host.Equals(\"github.com\", StringComparison.OrdinalIgnoreCase)\n        )","sourceCodeStart":684,"sourceCodeEnd":720,"githubUrl":"https://github.com/LykosAI/StabilityMatrix/blob/af93d6ef57c01cd890d7e0ad0a9ea8c9fcda3002/StabilityMatrix.Avalonia/ViewModels/PackageManager/PackageExtensionBrowserViewModel.cs#L684-L720","documentation":"In InstallExtensionManualAsync, the 'Manual Extension Install' dialog's URL field validator throws DataValidationException('URL is required') when the submitted text is null or whitespace. It is a guard ensuring a URL is present before attempting to parse or fetch it.","triggerScenarios":"Clicking the primary (install) button of the Manual Extension Install dialog with the Extension URL field left blank or containing only whitespace.","commonSituations":"User opens the manual install dialog intending to paste a git URL but submits before pasting; pasting only whitespace after clearing the clipboard.","solutions":["Enter a valid absolute extension URL (e.g. a GitHub repository URL) in the Extension URL field before confirming.","If automating, ensure the text passed to the dialog validator is non-empty."],"exampleFix":"// before\nValidator = text => { if (string.IsNullOrWhiteSpace(text)) throw new DataValidationException(\"URL is required\"); ... }\n// after\nValidator = text => {\n    var url = text?.Trim();\n    if (string.IsNullOrEmpty(url)) throw new DataValidationException(\"URL is required\");\n    if (!Uri.TryCreate(url, UriKind.Absolute, out _)) throw new DataValidationException(\"Invalid URL format\");\n}","handlingStrategy":"validation","validationCode":"if (!string.IsNullOrWhiteSpace(urlText)) {\n    // safe to open dialog / call InstallExtensionManualAsync\n}","typeGuard":"bool HasUrl(string? s) => !string.IsNullOrWhiteSpace(s);","tryCatchPattern":"try { await viewModel.InstallExtensionManualAsync(); }\ncatch (DataValidationException ex) { Notify(ex.Message); }","preventionTips":["Always paste the full extension URL before confirming the dialog.","Keep the URL on the clipboard until the dialog succeeds.","Validate the URL in code before passing it to the dialog."],"tags":["validation","input","url"],"backgroundTag":"empty-required-field","analyzedSha":"af93d6ef57c01cd890d7e0ad0a9ea8c9fcda3002","analyzedAt":"2026-09-12T19:02:43.389Z","contentChangedAt":"2026-09-12T19:02:43.389Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}