{"record":{"id":"2b9120d6f1cfbda8","repo":"OrchardCMS/OrchardCore","slug":"unknown-name-value-val","errorCode":null,"errorMessage":"Unknown ${name} value: ${val}.","messagePattern":"Unknown (.+?) value: (.+?)\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/OrchardCore.Modules/OrchardCore.SignalR/wwwroot/Scripts/signalr.js","lineNumber":329,"sourceCode":"// Version token that will be replaced by the prepack command\n/** The version of the SignalR client. */\nconst VERSION = \"8.0.17\";\n/** @private */\nclass Arg {\n    static isRequired(val, name) {\n        if (val === null || val === undefined) {\n            throw new Error(`The '${name}' argument is required.`);\n        }\n    }\n    static isNotEmpty(val, name) {\n        if (!val || val.match(/^\\s*$/)) {\n            throw new Error(`The '${name}' argument should not be empty.`);\n        }\n    }\n    static isIn(val, values, name) {\n        // TypeScript enums have keys for **both** the name and the value of each enum member on the type itself.\n        if (!(val in values)) {\n            throw new Error(`Unknown ${name} value: ${val}.`);\n        }\n    }\n}\n/** @private */\nclass Platform {\n    // react-native has a window but no document so we should check both\n    static get isBrowser() {\n        return !Platform.isNode && typeof window === \"object\" && typeof window.document === \"object\";\n    }\n    // WebWorkers don't have a window object so the isBrowser check would fail\n    static get isWebWorker() {\n        return !Platform.isNode && typeof self === \"object\" && \"importScripts\" in self;\n    }\n    // react-native has a window but no document\n    static get isReactNative() {\n        return !Platform.isNode && typeof window === \"object\" && typeof window.document === \"undefined\";\n    }\n    // Node apps shouldn't have a window object, but WebWorkers don't either","sourceCodeStart":311,"sourceCodeEnd":347,"githubUrl":"https://github.com/OrchardCMS/OrchardCore/blob/4306c0717fe573f6fca1b4955909ddab6a192807/src/OrchardCore.Modules/OrchardCore.SignalR/wwwroot/Scripts/signalr.js#L311-L347","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Use the exported enum constants (e.g. signalR.HttpTransportType.WebSockets) instead of raw numbers/strings","Verify the value exists for your client version of @microsoft/signalr","Check case/type of the value (string vs number) before passing"],"exampleFix":"// before\n.withUrl(url, 7)\n// after\n.withUrl(url, signalR.HttpTransportType.WebSockets | signalR.HttpTransportType.ServerSentEvents)","handlingStrategy":"type-guard","validationCode":"if (!(value in signalR.HttpTransportType)) throw new Error('invalid transport value');","typeGuard":"function isTransport(v){ return Object.values(signalR.HttpTransportType).includes(v); }","tryCatchPattern":"try { builder.withUrl(url, transport); } catch (e) { if (e.message.includes('Unknown')) { console.error('Bad enum value:', e.message); transport = signalR.HttpTransportType.None; } }","preventionTips":["Always use exported enum constants","Don't hardcode numeric enum values across versions","Validate values parsed from config/strings"],"tags":["javascript","signalr","invalid-enum","validation"],"backgroundTag":"invalid-enum-value","analyzedSha":"4306c0717fe573f6fca1b4955909ddab6a192807","analyzedAt":"2026-09-13T17:41:05.024Z","contentChangedAt":"2026-09-13T17:41:05.024Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}