dotnet/yarp · error · NotSupportedException

{string.Join(";", transformValues.Keys)}

Error message

{string.Join(";", transformValues.Keys)}

What it means

Thrown by QueryTransformFactory.Build when a query-string transform entry declares a 'QueryValueParameter' key but includes neither an 'Append' nor a 'Set' sub-key. The factory can only produce a meaningful transform when one of those two value keys is present, so it hard-stops with a NotSupportedException listing the actual keys found. This is the Build-time guard; the sibling Validate method reports the same condition non-throwing during config loading.

Source

Thrown at src/ReverseProxy/Transforms/QueryTransformFactory.cs:63

        return true;
    }

    public bool Build(TransformBuilderContext context, IReadOnlyDictionary<string, string> transformValues)
    {
        if (transformValues.TryGetValue(QueryValueParameterKey, out var queryValueParameter))
        {
            TransformHelpers.CheckTooManyParameters(transformValues, expected: 2);
            if (transformValues.TryGetValue(AppendKey, out var appendValue))
            {
                context.AddQueryValue(queryValueParameter, appendValue, append: true);
            }
            else if (transformValues.TryGetValue(SetKey, out var setValue))
            {
                context.AddQueryValue(queryValueParameter, setValue, append: false);
            }
            else
            {
                throw new NotSupportedException(string.Join(";", transformValues.Keys));
            }
        }
        else if (transformValues.TryGetValue(QueryRouteParameterKey, out var queryRouteParameter))
        {
            TransformHelpers.CheckTooManyParameters(transformValues, expected: 2);
            if (transformValues.TryGetValue(AppendKey, out var routeValueKeyAppend))
            {
                context.AddQueryRouteValue(queryRouteParameter, routeValueKeyAppend, append: true);
            }
            else if (transformValues.TryGetValue(SetKey, out var routeValueKeySet))
            {
                context.AddQueryRouteValue(queryRouteParameter, routeValueKeySet, append: false);
            }
            else
            {
                throw new NotSupportedException(string.Join(";", transformValues.Keys));
            }
        }

View on GitHub (pinned to bd11867bee)

Solutions

  1. Add either an "Append" or "Set" key to the transform entry, e.g. { "QueryValueParameter": "foo", "Set": "bar" }.
  2. If the key name was a typo, correct it to exactly "Append" or "Set" (case-sensitive) and rebuild.
  3. If you are building transforms programmatically, double-check the IReadOnlyDictionary<string,string> you hand to Build contains exactly the expected keys.
  4. Ensure startup config validation is enabled so this is caught as a validation error (non-throwing) rather than reaching Build at runtime.

Example fix

// before (appsettings.json)
{ "Transforms": [ { "QueryValueParameter": "q" } ] }
// after
{ "Transforms": [ { "QueryValueParameter": "q", "Set": "value" } ] }
Defensive patterns

Strategy: validation

Validate before calling

// Before building, ensure a QueryValueParameter transform has Append or Set
if (transformValues.ContainsKey("QueryValueParameter")
    && !transformValues.ContainsKey("Append")
    && !transformValues.ContainsKey("Set"))
{
    throw new InvalidOperationException(
        "QueryValueParameter transform requires an 'Append' or 'Set' key.");
}

Type guard

// Validate a transform entry before passing it to the factory
static bool IsValidQueryValueTransform(IReadOnlyDictionary<string, string> t)
    => t.ContainsKey("QueryValueParameter")
       && (t.ContainsKey("Append") || t.ContainsKey("Set"));

Prevention

When it happens

Trigger: A transform dictionary passed to Build that contains { "QueryValueParameter": "foo" } with no "Append" or "Set" entry. Happens when calling TransformBuilderContext/ITransformFactory.Build directly in code, or when a malformed transform slips past startup config validation (e.g. a custom config provider, or config validation disabled).

Common situations: Typo'd key in appsettings.json such as 'Appendd' or 'Sett' instead of 'Append'/'Set'; a copy-pasted transform block where the Set/Append line was accidentally deleted; a dynamic/config-database-driven transform store that emits a partial entry.

Related errors


AI-assisted analysis of dotnet/yarp@bd11867bee (2026-08-13). Data as JSON: /api/errors/fe54ceddc1103b3e. Report an issue: GitHub.