{"record":{"id":"7ec7669667342406","repo":"OrchardCMS/OrchardCore","slug":"the-name-argument-should-not-be-empty","errorCode":null,"errorMessage":"The '${name}' argument should not be empty.","messagePattern":"The '(.+?)' argument should not be empty\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/OrchardCore.Modules/OrchardCore.SignalR/wwwroot/Scripts/signalr.js","lineNumber":323,"sourceCode":"\n;// CONCATENATED MODULE: ./src/Utils.ts\n// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n\n\n// 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;","sourceCodeStart":305,"sourceCodeEnd":341,"githubUrl":"https://github.com/OrchardCMS/OrchardCore/blob/4306c0717fe573f6fca1b4955909ddab6a192807/src/OrchardCore.Modules/OrchardCore.SignalR/wwwroot/Scripts/signalr.js#L305-L341","documentation":"Argument-validation helper in the bundled SignalR JS client (Arg.isNotEmpty): a required string argument is null, undefined, or whitespace-only. The '{name}' in the message identifies which parameter failed. Thrown by SignalR client API misuse — e.g. calling connection methods with an empty URL, hub name, access token, or event name.","triggerScenarios":"Passing \"\", \"   \" or null as a name-type string argument to SignalR client APIs that validate with Arg.isNotEmpty (e.g. connection ids, method names, tokens).","commonSituations":"Empty access-token string from a failed auth fetch, blank event/method name built dynamically, uninitialized state variable used as an argument.","solutions":["Trim and check the string is non-empty before calling the API","Fix the upstream source producing the empty value (token fetch, form input)","Fall back to a default non-empty value where appropriate"],"exampleFix":"// before\nconnection.on(methodName, handler); // methodName = ''\n// after\nif (methodName && methodName.trim()) connection.on(methodName, handler);","handlingStrategy":"validation","validationCode":"const isNotBlank = (s) => typeof s === 'string' && s.trim().length > 0;","typeGuard":"function isNonEmptyString(v){ return typeof v === 'string' && v.trim() !== ''; }","tryCatchPattern":"try { connection.on(name, handler); } catch (e) { if (e.message.includes('should not be empty')) { console.error(`Invalid argument '${name}'`); } }","preventionTips":["Trim user/config-derived strings before use","Check token/method-name sources for empty results","Default to a safe non-empty value where valid"],"tags":["javascript","signalr","empty-string","validation"],"backgroundTag":"empty-required-field","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"}