2dust/v2rayN · error · ArgumentException
webdav parameter error or null
Error message
webdav parameter error or null
What it means
Thrown by WebDavManager.GetClient when any of WebDavItem.Url, UserName, or Password is null or empty. These three are required to construct the WebDAV client, so the manager refuses to proceed.
Source
Thrown at v2rayN/ServiceLib/Manager/WebDavManager.cs:30
private string? _lastDescription;
private string _webDir = Global.AppName + "_backup";
private readonly string _webFileName = "backup.zip";
private readonly string _tag = "WebDav--";
public WebDavManager()
{
_config = AppManager.Instance.Config;
}
private async Task<bool> GetClient()
{
try
{
if (_config.WebDavItem.Url.IsNullOrEmpty()
|| _config.WebDavItem.UserName.IsNullOrEmpty()
|| _config.WebDavItem.Password.IsNullOrEmpty())
{
throw new ArgumentException("webdav parameter error or null");
}
if (_client != null)
{
_client?.Dispose();
_client = null;
}
if (_config.WebDavItem.DirName.IsNullOrEmpty())
{
_webDir = Global.AppName + "_backup";
}
else
{
_webDir = _config.WebDavItem.DirName.TrimEx();
}
// Ensure BaseAddress URL ends with a trailing slash
var baseUrl = _config.WebDavItem.Url.Trim().TrimEnd('/') + "/";
View on GitHub (pinned to e01717d832)
Solutions
- Open WebDAV settings and fill in URL, UserName, and Password completely.
- Validate the three fields in the settings UI before enabling WebDAV backup (show a validation error instead of letting GetClient throw).
- Confirm the URL includes the scheme and full WebDAV path (e.g. https://host/dav/).
- If migrating configs, ensure WebDavItem is populated (default values are null/empty and will trip this).
Example fix
// before - throws deep in GetClient when settings are incomplete
await webDav.GetClient();
// after - validate at the UI/call boundary
var w = _config.WebDavItem;
if (w.Url.IsNullOrEmpty() || w.UserName.IsNullOrEmpty() || w.Password.IsNullOrEmpty())
{
throw new InvalidOperationException("Configure WebDAV URL, username, and password before use.");
} Defensive patterns
Strategy: validation
Validate before calling
var w = _config.WebDavItem;
if (string.IsNullOrEmpty(w?.Url) || string.IsNullOrEmpty(w.UserName) || string.IsNullOrEmpty(w.Password))
throw new InvalidOperationException("Configure WebDAV URL, username, and password before use."); Type guard
static bool IsWebDavConfigured(WebDavItem w) => w != null && !string.IsNullOrEmpty(w.Url) && !string.IsNullOrEmpty(w.UserName) && !string.IsNullOrEmpty(w.Password);
Try / catch
try
{
await webDavManager.GetClient();
}
catch (ArgumentException ex) when (ex.Message.Contains("webdav parameter"))
{
// settings incomplete; prompt user to configure WebDAV credentials
} Prevention
- Validate Url, UserName, and Password in the settings UI before enabling WebDAV backup.
- Ensure the URL includes scheme and full WebDAV path.
- After config migration/reset, confirm WebDavItem is populated.
When it happens
Trigger: GetClient checks _config.WebDavItem; if Url, UserName, or Password is null/empty (IsNullOrEmpty true), it throws ArgumentException before building the client.
Common situations: WebDAV backup was never configured; user saved partial settings (URL but no credentials); password field cleared; config migration/reset left WebDavItem default; credentials stored in a different field by mistake.
Related errors
- Failed to build UDP request packet.
- SOCKS5 address type {AddressType} not supported.
- Source directory not found: {dir.FullName}
AI-assisted analysis of 2dust/v2rayN@e01717d832 (2026-08-13).
Data as JSON: /api/errors/e8b3b5026c80d97e.
Report an issue: GitHub.