dotnet/aspnetcore · error · Error

Unknown ${name} value: ${val}.

Error message

Unknown ${name} value: ${val}.

What it means

Arg.isIn checks that a value is a valid member of a TypeScript enum (TransferFormat, HttpTransportType) by testing membership in the enum object. It throws for any value outside the known enum set, catching invalid numeric or string selections early.

Source

Thrown at src/SignalR/clients/ts/signalr/src/Utils.ts:32

export { VERSION };
/** @private */
export class Arg {
    public static isRequired(val: any, name: string): void {
        if (val === null || val === undefined) {
            throw new Error(`The '${name}' argument is required.`);
        }
    }
    public static isNotEmpty(val: string, name: string): void {
        if (!val || val.match(/^\s*$/)) {
            throw new Error(`The '${name}' argument should not be empty.`);
        }
    }

    public static isIn(val: any, values: any, name: string): void {
        // TypeScript enums have keys for **both** the name and the value of each enum member on the type itself.
        if (!(val in values)) {
            throw new Error(`Unknown ${name} value: ${val}.`);
        }
    }
}

/** @private */
export class Platform {
    // react-native has a window but no document so we should check both
    public static get isBrowser(): boolean {
        return !Platform.isNode && typeof window === "object" && typeof window.document === "object";
    }

    // WebWorkers don't have a window object so the isBrowser check would fail
    public static get isWebWorker(): boolean {
        return !Platform.isNode && typeof self === "object" && "importScripts" in self;
    }

    // react-native has a window but no document
    static get isReactNative(): boolean {

View on GitHub (pinned to 294cab2f9b)

Solutions

  1. Pass a value from the enum itself, e.g. HttpTransportType.WebSockets, not a raw number.
  2. Validate user-supplied transport selections against the enum before calling withUrl.
  3. Update the client package if enum values changed in a newer version.
  4. Default to HttpTransportType.None to let SignalR negotiate a supported transport.

Example fix

// before
withUrl(url, 99); // not in HttpTransportType

// after
withUrl(url, HttpTransportType.WebSockets);
Defensive patterns

Strategy: validation

Validate before calling

function requireEnum<T extends object>(val: unknown, enumObj: T, name: string): void {
  if (!(val in enumObj)) {
    throw new Error(`Unknown ${name} value: ${String(val)}`);
  }
}

Type guard

function isTransferFormat(v: unknown): v is TransferFormat {
  return v === TransferFormat.Text || v === TransferFormat.Binary;
}

Prevention

When it happens

Trigger: Passing a transport type or transfer format value not present in the enum, e.g. withUrl(url, 99) or a numeric value that does not map to HttpTransportType.

Common situations: Wrong numeric literal, an enum value that changed across versions, or feeding a user-controlled number straight into the API without validation.

Related errors


AI-assisted analysis of dotnet/aspnetcore@294cab2f9b (2026-08-06). Data as JSON: /api/errors/ecc0ee84b090f9d5. Report an issue: GitHub.