OrchardCMS/OrchardCore · error · Error

The ' ' argument should not be empty.

Error message

The '${name}' argument should not be empty.

What it means

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.

Solutions

  1. Trim and check the string is non-empty before calling the API
  2. Fix the upstream source producing the empty value (token fetch, form input)
  3. Fall back to a default non-empty value where appropriate

Example fix

// before
connection.on(methodName, handler); // methodName = ''
// after
if (methodName && methodName.trim()) connection.on(methodName, handler);
Defensive patterns

Strategy: validation

Validate before calling

const isNotBlank = (s) => typeof s === 'string' && s.trim().length > 0;

Type guard

function isNonEmptyString(v){ return typeof v === 'string' && v.trim() !== ''; }

Try / catch

try { connection.on(name, handler); } catch (e) { if (e.message.includes('should not be empty')) { console.error(`Invalid argument '${name}'`); } }

Prevention

When it happens

Trigger: 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).

Common situations: Empty access-token string from a failed auth fetch, blank event/method name built dynamically, uninitialized state variable used as an argument.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


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

Appendix: source

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

;// CONCATENATED MODULE: ./src/Utils.ts
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.


// 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;

View on GitHub (pinned to 4306c0717f)