Skip to content

CSOM: loading an SP.Web nested in another object’s load fails with “Value cannot be null. Parameter name: target” or returns the web without Id #11057

Closed

Description

Target SharePoint environment

SharePoint Online

What SharePoint development model, framework, SDK or API is this about?

SharePoint CSOM

Developer environment

Windows

What browser(s) / client(s) have you tested

  • 💥 Internet Explorer
  • 💥 Microsoft Edge
  • 💥 Google Chrome
  • 💥 FireFox
  • 💥 Safari
  • mobile (iOS/iPadOS)
  • mobile (Android)
  • not applicable
  • other (enter in the "Additional environment details" area below)

Additional environment details

  • Microsoft.SharePointOnline.CSOM 16.1.27515.12000, also reproduced on 16.1.27709.12000 (latest)
  • .NET 10 console app, MSAL 4.90.1
  • App-only auth (Entra app registration, certificate), https://<tenant>.sharepoint.com/.default
  • Reproduced on multiple tenants and on multiple ordinary top-level sites per tenant
  • Noticed the change in behaviour on 12th October. The same code had been working against these tenants before that.

Describe the bug / error

Since around 12th October, CSOM requests that load an SP.Web nested inside another object's load fail on the server. The same web loaded as its own object still works.

  • Requesting a property of the nested web throws:
    Microsoft.SharePoint.Client.ServerException: Value cannot be null. Parameter name: target (ServerErrorTypeName System.ArgumentNullException)
  • Requesting the nested web itself returns it without its default properties, so reading Id afterwards throws PropertyOrFieldNotInitializedException.

Target SharePoint environment

SharePoint Online

What SharePoint development model, framework, SDK or API is this about?

SharePoint CSOM

Developer environment

Windows

What browser(s) / client(s) have you tested

  • 💥 Internet Explorer
  • 💥 Microsoft Edge
  • 💥 Google Chrome
  • 💥 FireFox
  • 💥 Safari
  • mobile (iOS/iPadOS)
  • mobile (Android)
  • not applicable
  • other (enter in the "Additional environment details" area below)

Additional environment details

  • Microsoft.SharePointOnline.CSOM 16.1.27515.12000, also reproduced on 16.1.27709.12000 (latest)
  • .NET 10 console app, MSAL 4.90.1
  • App-only auth (Entra app registration, certificate), https://<tenant>.sharepoint.com/.default
  • Reproduced on multiple tenants and on multiple ordinary top-level sites per tenant
  • Started on 2026-10-12. The same code had been working against these tenants before that.

Describe the bug / error

Since around 2026-10-12, CSOM requests that load an SP.Web nested inside another object's load fail on the server. The same web loaded as its own object still works.

  • Requesting a property of the nested web throws:
    Microsoft.SharePoint.Client.ServerException: Value cannot be null. Parameter name: target (ServerErrorTypeName System.ArgumentNullException)
  • Requesting the nested web itself returns it without its default properties, so reading Id afterwards throws PropertyOrFieldNotInitializedException.
Request Result
ctx.Load(ctx.Web, w => w.Id) ✅ works
ctx.Load(ctx.Site.RootWeb, w => w.Id) ✅ works
ctx.Load(list.ParentWeb, w => w.Id) ✅ works
ctx.Load(ctx.Site, s => s.RootWeb.Id) ❌ Value cannot be null. Parameter name: target
ctx.Load(ctx.Site, s => s.RootWeb.Title) ❌ same
ctx.Load(list, l => l.ParentWeb.Id) ❌ same
ctx.Load(ctx.Site, s => s.RootWeb) ❌ RootWeb returned but Id not initialised
ctx.Load(list, l => l.ParentWeb) ❌ ParentWeb returned but Id not initialised
ctx.Load(item, i => i.FirstUniqueAncestorSecurableObject) where the item inherits permissions from the web ❌ TypedObject is an SP.Web but Id not initialised
Explicit ctx.Load(ancestorWeb, w => w.Id) after the previous row ✅ works
ctx.Load(ctx.Web, w => w.ParentWeb.Id) (returns WebInformation, not Web) ✅ works
item.FirstUniqueAncestorSecurableObject when the ancestor is a List or a folder ✅ works, Id returned
REST /_api/site/rootweb, /_api/web/lists/getbytitle('...')/parentweb ✅ works

So the server cannot resolve an SP.Web when it is part of a site's, list's or list item's load, but it can when the web is the object being loaded.

Steps to reproduce

Minimal repro using only Microsoft.SharePointOnline.CSOM and Microsoft.Identity.Client:

using Microsoft.Identity.Client;
using Microsoft.SharePoint.Client;
using System.Security.Cryptography.X509Certificates;

string tenantId = "<tenant-id>";
string clientId = "<client-id>";
var siteUrl = new Uri("https://<tenant>.sharepoint.com/sites/<site>");
X509Certificate2 certificate = /* app certificate */;

IConfidentialClientApplication app = ConfidentialClientApplicationBuilder.Create(clientId)
    .WithCertificate(certificate)
    .WithAuthority(new Uri($"https://login.microsoftonline.com/{tenantId}"))
    .Build();

AuthenticationResult token = await app
    .AcquireTokenForClient(new[] { "https://<tenant>.sharepoint.com/.default" })
    .ExecuteAsync();

using var context = new ClientContext(siteUrl);
context.ExecutingWebRequest += (sender, e) =>
    e.WebRequestExecutor.RequestHeaders["Authorization"] = "Bearer " + token.AccessToken;

// 1. Works: web loaded directly
context.Load(context.Web, w => w.Id, w => w.Title);
await context.ExecuteQueryAsync();

// 2. Works: the root web loaded as its own object
var rootWeb = context.Site.RootWeb;
context.Load(rootWeb, w => w.Id, w => w.Title);
await context.ExecuteQueryAsync();

// 3. Fails: the same root web requested nested inside the Site load
context.Load(context.Site, s => s.Id, s => s.RootWeb.Id, s => s.RootWeb.Title);
try
{
    await context.ExecuteQueryAsync();
}
catch (ServerException se)
{
    // ServerException (System.ArgumentNullException): Value cannot be null. Parameter name: target
    Console.WriteLine(se.ServerErrorTraceCorrelationId);
    Console.WriteLine(DateTime.UtcNow.ToString("ddd, dd MMM yyy HH':'mm':'ss 'GMT'"));
}

Output:

1. context.Web                       OK   <web-id> - <title>
2. Load(Site.RootWeb, w => w.Id)     OK   <web-id> - <title>
3. Load(Site, s => s.RootWeb.Id)     FAIL System.ArgumentNullException: Value cannot be null. Parameter name: target

Expected behavior

Requesting s => s.RootWeb.Id, l => l.ParentWeb.Id or an item's FirstUniqueAncestorSecurableObject returns the web and its requested properties, as it did before 2026-10-12 and as the equivalent REST calls still do.

Activity

  1. m365-agent-toolkit-assistant commented on Oct 13, 2026

    @m365-agent-toolkit-assistant

    👋 Hi Chris Redman (@chrisredman01),

    Thank you for reporting this issue. Here is an AI-generated initial response:

    Classification: Bug — The reported regression in SharePoint Online CSOM is consistent with a defect, though its root cause is unconfirmed.

    • You report that loading a web directly succeeds, while requesting that same web’s Id through Site.RootWeb or List.ParentWeb throws a server exception on two CSOM versions and multiple tenants. The type:bug-suspected label is a triage signal, not confirmation.
    • CSOM documentation says properties must be explicitly loaded before they are read. Loading only s => s.RootWeb therefore does not, by itself, establish that Id should be initialized.

    What to do now:

    1. As a workaround, load RootWeb, ParentWeb, or the returned ancestor web as its own object, explicitly requesting Id, then execute the query.
    2. Provide the failing request’s correlation ID and UTC timestamp to Microsoft support alongside the minimal reproduction. No fix or fixing package version is established.

    Useful links:


    Note: AI-generated guidance may be incomplete or incorrect. Please verify suggestions before applying them.

  2. chrisredman01 commented on Oct 13, 2026

    @chrisredman01
    Author

    Example correlation id:
    206844a2-00e8-e000-5176-372195a7b212
    Tue, 13 Oct 2026 08:16:02 GMT

  3. WGroenestein commented on Oct 13, 2026

    @WGroenestein

    We have (at least) 70+ customers (tenants) (and it appears to be ramping up) that are hitting this issue through our CSOM integration (l => l.ParentWeb.Url)

  4. xinzhaozhang1985 commented on Oct 13, 2026

    @xinzhaozhang1985

    Updated from Microsoft Support team:

    "I reviewed this internally, and found the behavior is related to a recent update that introduces changes to the CSOM surface. Deployment started around October 8th and is still in progress. Less than 20% of the production environments have been updated so far, which is why other tenants using your application have not reported any issues."

  5. workpoint-hm commented on Oct 14, 2026

    @workpoint-hm

    We are seeing the exact same issue.

    The first occurrence in our logs was on October 11, 2026 at 17:33 CET. Since then, the issue has escalated significantly, and as of yesterday we are seeing the same error across 68 different tenants.

    We have not made any related changes on our side.

  6. Ashlesha-MSFT commented on Oct 14, 2026

    @Ashlesha-MSFT
    Contributor

    Although I couldn't reproduce the behavior in my tenant, the information now available indicates that the issue is tenant/rollout-dependent. The same previously working CSOM pattern is failing across multiple customer tenants and CSOM package versions, while loading the same SP.Web object directly continues to work.

    The reports also indicate that the first failures coincide with a recent SharePoint Online service update. I’m escalating this to the SharePoint engineering team for investigation and to confirm whether it is related to the currently reported SharePoint service incident involving null-target exceptions.

    For now, the available workaround is to load RootWeb, ParentWeb, or the returned ancestor web as a separate object and explicitly request the required properties, instead of loading the nested SP.Web through the parent object.

  7. chrisredman01 commented on Oct 14, 2026

    @chrisredman01
    Author

    Ashlesha-MSFT thanks for the update. This seems to have started working again on my own tenant. Have Microsoft started to rollback the code changes?

  8. added
    status:fixedIssue was fixed in current or prior release.
    and removed
    type:bug-suspectedSuspected bug (not working as designed/expected). See “type:bug-confirmed” for confirmed bugs.
    on Oct 19, 2026
  9. VesaJuvonen commented on Oct 19, 2026

    @VesaJuvonen
    Contributor

    Chris Redman (@chrisredman01) - this seemed to be the same underlaying issue as with #11056 & #11059

    This was engineering work related on future security adjustments in the platform. Engineering has acknowledged that they missed core customer scenarios on their validation and are fixing that until any further progress on the planned work. Highly unfortunately situation, resulting direct customer impact. Work is being now done to avoid these kind of issues in future.

    Closing as fixed as confirmed also by Chris Redman (@chrisredman01) - and the code change has been rolled back.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

AI-generated responsearea:csom/rest/apiCategory: SharePoint Client Side Object Model SDK / REST APIstatus:fixedIssue was fixed in current or prior release.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions