OrchardCMS/OrchardCore · error · Error

Unknown value: .

Error message

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

What it means

Arg.isIn validates that a value is a member of an allowed enum/object; if `val in values` is false it throws 'Unknown <name> value: <val>.' The SignalR client uses it to reject invalid enum values such as unsupported transport or message types.

Solutions

  1. Use the exported enum constants (e.g. signalR.HttpTransportType.WebSockets) instead of raw numbers/strings
  2. Verify the value exists for your client version of @microsoft/signalr
  3. Check case/type of the value (string vs number) before passing

Example fix

// before
.withUrl(url, 7)
// after
.withUrl(url, signalR.HttpTransportType.WebSockets | signalR.HttpTransportType.ServerSentEvents)
Defensive patterns

Strategy: type-guard

Validate before calling

if (!(value in signalR.HttpTransportType)) throw new Error('invalid transport value');

Type guard

function isTransport(v){ return Object.values(signalR.HttpTransportType).includes(v); }

Try / catch

try { builder.withUrl(url, transport); } catch (e) { if (e.message.includes('Unknown')) { console.error('Bad enum value:', e.message); transport = signalR.HttpTransportType.None; } }

Prevention

When it happens

Trigger: Passing an invalid value for an enum-like parameter, e.g. an HttpTransportType not in the allowed set, or a negotiated/serialized value not present in the enum map (log level, transfer format).

Common situations: Hand-written transport values (e.g. skipNegotiation with wrong transport), numeric values from older/newer client versions not present in the enum, string vs number mix-ups.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of OrchardCMS/OrchardCore@4306c0717f (2026-09-13). Data as JSON: /api/errors/2b9120d6f1cfbda8. Report an issue: GitHub.

Appendix: source

Thrown at src/OrchardCore.Modules/OrchardCore.SignalR/wwwroot/Scripts/signalr.js:329

// Version token that will be replaced by the prepack command
/** The version of the SignalR client. */
const VERSION = "8.0.17";
/** @private */
class Arg {
    static isRequired(val, name) {
        if (val === null || val === undefined) {
            throw new Error(`The '${name}' argument is required.`);
        }
    }
    static isNotEmpty(val, name) {
        if (!val || val.match(/^\s*$/)) {
            throw new Error(`The '${name}' argument should not be empty.`);
        }
    }
    static isIn(val, values, name) {
        // 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 */
class Platform {
    // react-native has a window but no document so we should check both
    static get isBrowser() {
        return !Platform.isNode && typeof window === "object" && typeof window.document === "object";
    }
    // WebWorkers don't have a window object so the isBrowser check would fail
    static get isWebWorker() {
        return !Platform.isNode && typeof self === "object" && "importScripts" in self;
    }
    // react-native has a window but no document
    static get isReactNative() {
        return !Platform.isNode && typeof window === "object" && typeof window.document === "undefined";
    }
    // Node apps shouldn't have a window object, but WebWorkers don't either

View on GitHub (pinned to 4306c0717f)