{"record":{"id":"116025477b97d653","repo":"Devolutions/UniGetUI","slug":"the-source-name-is-required","errorCode":null,"errorMessage":"The source name is required.","messagePattern":"The source name is required\\.","errorType":"validation","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/UniGetUI.Interface.IpcApi/IpcManagerSettingsApi.cs","lineNumber":406,"sourceCode":"        {\n            return null;\n        }\n\n        return PEInterface.Managers.FirstOrDefault(manager =>\n            manager.Id.Equals(managerName, StringComparison.OrdinalIgnoreCase)\n            || manager.Name.Equals(managerName, StringComparison.OrdinalIgnoreCase)\n            || manager.DisplayName.Equals(managerName, StringComparison.OrdinalIgnoreCase)\n        );\n    }\n\n    private static IManagerSource ResolveSourceForAdd(\n        IPackageManager manager,\n        IpcSourceRequest request\n    )\n    {\n        if (string.IsNullOrWhiteSpace(request.SourceName))\n        {\n            throw new InvalidOperationException(\"The source name is required.\");\n        }\n\n        if (!string.IsNullOrWhiteSpace(request.SourceUrl))\n        {\n            return new ManagerSource(\n                manager,\n                request.SourceName,\n                new Uri(request.SourceUrl, UriKind.Absolute)\n            );\n        }\n\n        return manager.Properties.KnownSources.FirstOrDefault(source =>\n                SourceMatches(source, request.SourceName, null)\n            )\n            ?? throw new InvalidOperationException(\n                $\"No known source matching \\\"{request.SourceName}\\\" was found for manager \\\"{manager.Name}\\\".\"\n            );\n    }","sourceCodeStart":388,"sourceCodeEnd":424,"githubUrl":"https://github.com/Devolutions/UniGetUI/blob/9b1d7d0eab91620fc15c86b36676532095936ae3/src/UniGetUI.Interface.IpcApi/IpcManagerSettingsApi.cs#L388-L424","documentation":"Thrown by ResolveSourceForAdd when request.SourceName is null, empty, or whitespace. Adding a source requires at minimum a name; the URL is optional (falls back to KnownSources lookup) but the name is mandatory.","triggerScenarios":"Calling AddSourceAsync with an IpcSourceRequest where SourceName is empty/whitespace. The ManagerName must already be valid (ResolveManager is called before this check, so an invalid manager throws first).","commonSituations":"IPC client sends a source-add request with only a URL but no name, thinking the URL alone suffices. DTO initialization sets SourceName to empty string by default — omitting it in JSON leaves it empty.","solutions":["Set SourceName to a non-empty value on the IpcSourceRequest before calling AddSourceAsync.","If adding by URL, provide both SourceName and SourceUrl.","If adding a known source, provide SourceName that matches a known source's Name or DisplayName."],"exampleFix":"// before — URL only, no name\nawait IpcManagerSettingsApi.AddSourceAsync(new IpcSourceRequest {\n    ManagerName = \"scoop\", SourceUrl = \"https://extras.scoop.sh\"\n});\n// after\nawait IpcManagerSettingsApi.AddSourceAsync(new IpcSourceRequest {\n    ManagerName = \"scoop\", SourceName = \"extras\", SourceUrl = \"https://extras.scoop.sh\"\n});","handlingStrategy":"validation","validationCode":"if (string.IsNullOrWhiteSpace(request.SourceName))\n    throw new ArgumentException(\"Source name is required.\", nameof(request.SourceName));","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always provide SourceName when adding a source.","SourceUrl is optional for known sources but SourceName is always required.","DTO initializes SourceName to empty string — set it explicitly."],"tags":["sources","ipc","validation","required-field"],"backgroundTag":null,"analyzedSha":"9b1d7d0eab91620fc15c86b36676532095936ae3","analyzedAt":"2026-08-13T12:19:18.278Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}