Skip to content

SharePoint Online Search REST API parameter sortlist is causing an error (again) #11043

Description

@mcgeeky

Target SharePoint environment

SharePoint Online

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

SharePoint REST API

Developer environment

None

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

No response

Describe the bug / error

The SharePoint API endpoint _api/search is returning an error when using the sortlist parameter sortlist='[docid]:ascending'

The error returned is 400 BAD REQUEST with the message:

We didn't understand your search terms. Make sure they're using proper syntax

The full error code is:

<m:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<m:code>-1, Microsoft.Office.Server.Search.REST.SearchServiceException</m:code>
<m:message xml:lang="en-US">We didn't understand your search terms. Make sure they're using proper syntax.</m:message>
</m:error>

This appears to be the same error, or similar to, the one I reported in May 2024 which was subsequently fixed.

If this is a breaking change that has been deployed to SharePoint Online, we need the breaking change rollout stopped and then reverted before the impact spreads further to other tenants.

The sortlist parameter with [docid]=ascending is valid search syntax as per the Microsoft help article here. https://learn.microsoft.com/en-us/sharepoint/dev/general-development/pagination-for-large-result-sets

Steps to reproduce

Open Edge browser, sign in to your SharePoint site then copy and paste this URL in to the address bar and hit return, after changing YOURDOMAIN for your SharePoint tenant name:

https://YOURDOMAIN.sharepoint.com/_api/search/query?querytext='contentclass:STS_Site+(WebTemplate:GROUP OR WebTemplate:TEAMCHANNEL)'&sortlist='[docid]:ascending'

You will receive an error message.

If the sortlist parameter is removed from the query then it will succeed:

https://YOURDOMAIN.sharepoint.com/_api/search/query?querytext='contentclass:STS_Site+(WebTemplate:GROUP OR WebTemplate:TEAMCHANNEL)'

This will return an error on impacted tenants only. It appears to be affecting only a subset of tenants at present.

Expected behavior

The expected SharePoint search results should be returned, not an error.

Activity

  1. added
    type:bug-suspectedSuspected bug (not working as designed/expected). See “type:bug-confirmed” for confirmed bugs.
    on Oct 2, 2026
  2. m365-agent-toolkit-assistant commented on Oct 2, 2026

    @m365-agent-toolkit-assistant

    👋 Hi Myles Jeffery (@mcgeeky),

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

    Classification: Bug — the reported 400 response for sortlist='[docid]:ascending' conflicts with the documented SharePoint Search REST behavior. The cause of the current failure is not yet confirmed.

    • Microsoft Learn explicitly uses bracketed [docid] for ascending sorting and large-result pagination.
    • The reporter’s query and error closely mirror the 2024 report; users reported that the earlier failure later stopped. That history does not establish a new rollout or rollback.

    What to do now:

    1. Recheck the same query with and without sortlist on affected and unaffected tenants. Omitting it is only a temporary option if sorted results and DocId-based pagination are unnecessary.
    2. Open a Microsoft 365 support case with the request URL, UTC timestamp, tenant, response headers/correlation ID, and both responses. Request investigation of the documented syntax; no current fix or rollout is verified.

    Useful links:


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

  3. mcgeeky commented on Oct 2, 2026

    @mcgeeky
    Author

    Bringing this to your attention Mikael Svenson (@wobba)

  4. pdl5p commented on Oct 2, 2026

    @pdl5p

    I had reports of this happening yesterday too, looks like that issue from 2024 is back.

  5. bcameron1231 commented on Oct 2, 2026

    @bcameron1231
    Contributor

    I am seeing this as well. On one tenant sortList fails, on a different tenant it's working.

  6. wobba commented on Oct 4, 2026

    @wobba
    Contributor

    Does it work without brackets? docid:ascending

  7. mcgeeky commented on Oct 4, 2026

    @mcgeeky
    Author

    Does it work without brackets? docid:ascending

    No, it does not work without brackets either. The error is:

    We didn't understand your search terms. Make sure they're using proper syntax

  8. pdl5p commented on Oct 4, 2026

    @pdl5p

    Without brackets does work for me.

    Something else I've just found is that the square brackets do work if there is no sourceid parameter specified. It seems to be the combination of sourceid and [docid]:ascending that is breaking (at least for me)

  9. self-assigned this
    on Oct 5, 2026
  10. Ashlesha-MSFT commented on Oct 5, 2026

    @Ashlesha-MSFT
    Contributor

    Thanks for the details. I’ve reached out internally to the engineering team for confirmation on the issue. I’ll post an update here once I hear back from them.

  11. wobba commented on Oct 5, 2026

    @wobba
    Contributor

    For those with the issue, please remove [] if possible. We will likely update documentation of https://learn.microsoft.com/en-us/sharepoint/dev/general-development/pagination-for-large-result-sets to remove []. That said, we are investigating the regression.

  12. wobba commented on Oct 5, 2026

    @wobba
    Contributor

    See #11049

  13. mcgeeky commented on Oct 5, 2026

    @mcgeeky
    Author

    Thanks for the update Mikael Svenson (@wobba) . I'm assuming your plan is to revert the regression after your investigation to avoid impact on customers? We have at least one customer with a situation where [docid] and DocId (no square brackets) are causing a search error.

  14. wobba commented on Oct 7, 2026

    @wobba
    Contributor

    Myles Jeffery (@mcgeeky) still not sure what cause the regression as we should handle with both [] and without in the downstream logic. Mitigation should be to remove it until we find the root cause.

  15. mcgeeky commented on Oct 7, 2026

    @mcgeeky
    Author

    Mikael Svenson (@wobba) The earliest report we had of the issue was on 1st October, if that is any help with isolating the cause/update. I can provide the name of one of the affected tenants via private message on X?

  16. bcameron1231 commented on Oct 7, 2026

    @bcameron1231
    Contributor

    Removing the [] also works for me on the tenant it was failing. Supporting both syntax would be great.

  17. hstuermann commented on Oct 8, 2026

    @hstuermann

    Mikael Svenson (@wobba) suddenly we having this problem too on our tenants. Its now the next thing with the search api. What is going on here?

    Sending this via post (pnpjs). Was working this morning and now suddenly I am getting 400 errors and colleagues reporting that our solution stopped working?

    "SortList":[{"Direction":0,"Property":"DocId"}],
    

    Fallback with removing the SortList completly from the request works, but thats results in changes in the results...

  18. mcgeeky commented on Oct 8, 2026

    @mcgeeky
    Author

    We are seeing more reports of the issue with [docid] with square brackets. Is it not possible to stop the rollout of the change request that contains the regression to limit the impact?

  19. mcgeeky commented on Oct 8, 2026

    @mcgeeky
    Author

    hstuermann that's what I see too: DocId is broken, but was previously working, and [docid] is broken but was previously working. docid without square brackets does work.

    So there are two forms for [docid]/DocId for the sortlist parameter that have regressed.

  20. hstuermann commented on Oct 8, 2026

    @hstuermann

    Yes I had to implement a fallback now when the API is failing and changed the DocId to docid. But changing the solution every few days to fix sudden changes on MS side is not a working scenario.

  21. mcgeeky commented on Oct 8, 2026

    @mcgeeky
    Author

    But changing the solution every few days to fix sudden changes on MS side is not a working scenario.

    I agree.

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 APIarea:searchtype:bug-suspectedSuspected bug (not working as designed/expected). See “type:bug-confirmed” for confirmed bugs.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions