duplicati/duplicati · error · UnauthorizedAccessException
Strings.SharePoint.WebTitleReadFailedError
Error message
Strings.SharePoint.WebTitleReadFailedError
What it means
Thrown as an UnauthorizedAccessException in SharePointBackend.TestContextForWebAsync when ctx.Web.Title returns null after a successful ctx.ExecuteQueryAsync call. The SharePoint CSOM query completed without error, but the Web.Title property is null, indicating the web is accessible at the transport level but the title cannot be read. This is treated as an authorization failure because a properly authenticated request should return a non-null title.
Source
Thrown at Duplicati/Library/Backend/SharePoint/SharePointBackend.cs:224
#endregion
#region [Private helper methods]
/// <summary>
/// Tries a simple query to test the passed context.
/// Returns 0 on success, negative if completely invalid, positive if SharePoint error (wrong creds are negative).
/// </summary>
private static async Task<int> TestContextForWebAsync(ClientContext ctx, bool rethrow, TimeSpan timeout, CancellationToken cancelToken)
{
try
{
return await Utility.Utility.WithTimeout(timeout, cancelToken, async _ =>
{
ctx.Load(ctx.Web, w => w.Title);
await ctx.ExecuteQueryAsync().ConfigureAwait(false); // should fail and throw if anything wrong.
string webTitle = ctx.Web.Title;
if (webTitle == null)
throw new UnauthorizedAccessException(Strings.SharePoint.WebTitleReadFailedError);
return 0;
}).ConfigureAwait(false);
}
catch (ServerException)
{
if (rethrow) throw;
else return 1;
}
catch (Exception)
{
if (rethrow) throw;
else return -1;
}
}
/// <summary>
/// Builds a client context and tries a simple query to test if there's a web.
/// Returns 0 on success, negative if completely invalid, positive if SharePoint error (likely wrong creds).View on GitHub (pinned to 3f348be3e3)
Solutions
- Verify the SharePoint credentials have at least 'Read' permission on the target site/web.
- If using app-only/ACS authentication, ensure the principal has the 'Web.Read' or 'Sites.Read.All' permission scope.
- Test the same credentials by logging into the SharePoint site in a browser and confirming the site title loads.
- Confirm the URL points to a valid, fully-provisioned site collection.
Defensive patterns
Strategy: validation
Validate before calling
// Validate SharePoint credentials and permissions before relying on the context
var ctx = new ClientContext(siteUrl);
ctx.Credentials = credentials;
try
{
ctx.Load(ctx.Web, w => w.Title);
await ctx.ExecuteQueryAsync();
if (ctx.Web.Title == null)
throw new UnauthorizedAccessException("Account authenticated but cannot read site title; check permissions.");
}
catch (ServerException ex)
{
throw new InvalidOperationException($"SharePoint access test failed: {ex.Message}");
} Try / catch
try
{
var result = await TestContextForWebAsync(ctx, rethrow: true, timeout, cancellationToken);
}
catch (UnauthorizedAccessException ex) when (ex.Message == Strings.SharePoint.WebTitleReadFailedError)
{
logger.LogError("SharePoint authorization failed: account cannot read web title.");
// Grant the account Read permission on the site
throw;
} Prevention
- Grant the SharePoint account at least Read permission on the target site.
- For app-only auth, ensure the principal has 'Web.Read' or equivalent scope.
- Test credentials by logging into the SharePoint site in a browser before configuring the backup.
- Ensure the site collection is fully provisioned before connecting.
When it happens
Trigger: TestContextForWebAsync loads ctx.Web.Title and calls ExecuteQueryAsync. The query succeeds (no ServerException), but the returned webTitle is null. The method then throws UnauthorizedAccessException with the WebTitleReadFailedError string.
Common situations: Insufficient permissions on the SharePoint site (the account can authenticate but lacks read access to web properties); the site collection is in a partially provisioned or corrupted state; an app-only authentication token lacks the Site.Read scope; the SharePoint URL points to a web that exists but has restricted title visibility.
Related errors
- Element with path '{0}' not found on host '{1}'.
- Strings.SharePoint.NoSharePointWebFoundError(m_orgUrl.ToStri
- Strings.SharePoint.MissingElementError(serverRelPathInfo, m_
- Strings.SharePoint.MissingElementError(m_serverRelPath, m_sp
- Strings.SharePoint.MissingElementError(fileurl, m_spWebUrl)
AI-assisted analysis of duplicati/duplicati@3f348be3e3 (2026-08-13).
Data as JSON: /api/errors/65d90ba936816daf.
Report an issue: GitHub.