Skip to content

SearchParameterNotSupportedException thrown on all requests #5653

Description

@tswelsh

Describe the bug
We had been running version 4.0.632 of the server and recently upgraded to version 4.0.790. The upgrade involved running the SQL schema diff scripts from schema version 102 to schema version 113 before running the 4.0.790 image version. Following this, the server has been returning an error for all requests, e.g.

{
    "resourceType": "OperationOutcome",
    "id": "301ce81d-b85e-4c26-ba5d-3ae6a312be61",
    "meta": {
        "lastUpdated": "2026-06-30T15:05:43.6885012+00:00"
    },
    "issue": [
        {
            "severity": "error",
            "code": "not-supported",
            "details": {
                "text": "The request was invalid."
            },
            "diagnostics": "The search parameter '_type' is not supported for resource type 'Resource'."
        }
    ]
}

This is happening because a SearchParameterNotSupportedException is being thrown on various code paths, including building a CapabilityStatement, so is possibly throwing on everything that needs to do a search. I've traced through the code as best I can for a metadata request (so very simple, no parameters) and it looks like SearchParameterDefinitionManager.TryGetFromTypeLookup must be returning false: https://github.com/microsoft/fhir-server/blob/release/4.0.790/src/Microsoft.Health.Fhir.Core/Features/Definition/SearchParameterDefinitionManager.cs#L556. The parameter _type for resource type Resource is being added in SearchOptionsFactory via ResourceTypeSearchParameter: https://github.com/microsoft/fhir-server/blob/release/4.0.790/src/Microsoft.Health.Fhir.Shared.Core/Features/Search/SearchOptionsFactory.cs#L389. I haven't got to the bottom of how the type lookup inside SearchParameterDefinitionManager is populated so am a bit stumped at the moment.

There are now a couple of later releases that I could try but I'm a bit wary of changing anything further in case things go even more wrong. Looking at the changes between 4.0.632 and 4.0.790 there are various mentions of search parameters but difficult for me to tell if anything is relevant. Given that the whole thing is completely borked presumably others would have seen it, so possibly it's something to do with our data (although I don't think we do anything unusual).

FHIR Version?
Stu3

Data provider?
SQL Server

To Reproduce
Steps to reproduce the behavior:

  1. (Unsure if relevant) Upgrade SQL schema from version 4.0.632 to 4.0.790
  2. Run server at 4.0.790
  3. Make any query

Expected behavior
Well formed queries should return without error.

Actual behavior
An error is returned on every query.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugBug bug bug.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions