gchq/CyberChef · error · OperationError

No capitalization scope was provided.

Error message

No capitalization scope was provided.

What it means

To Upper Case requires a capitalization scope argument ('All', 'Word', 'Sentence', or 'Paragraph') that selects which portions of the input to uppercase. The guard throws when args is missing or empty, because without a scope the operation has no defined behaviour.

Source

Thrown at src/core/operations/ToUpperCase.mjs:42

        this.inputType = "string";
        this.outputType = "string";
        this.args = [
            {
                "name": "Scope",
                "type": "option",
                "value": ["All", "Word", "Sentence", "Paragraph"]
            }
        ];
    }

    /**
     * @param {string} input
     * @param {Object[]} args
     * @returns {string}
     */
    run(input, args) {
        if (!args || args.length === 0) {
            throw new OperationError("No capitalization scope was provided.");
        }

        const scope = args[0];

        if (scope === "All") {
            return input.toUpperCase();
        }

        const scopeRegex = {
            "Word": /(\b\w)/gi,
            "Sentence": /(?:\.|^)\s*(\b\w)/gi,
            "Paragraph": /(?:\n|^)\s*(\b\w)/gi
        }[scope];

        if (scopeRegex === undefined) {
            throw new OperationError("Unrecognized capitalization scope");
        }

View on GitHub (pinned to 4290ea7539)

Solutions

  1. Provide a scope argument: 'All', 'Word', 'Sentence', or 'Paragraph'.
  2. When building recipes programmatically, always include the args array with the default 'All'.
  3. Re-add the operation through the UI to restore its default arguments.

Example fix

// before: op.run(input, [])               -> throws
// after:  op.run(input, ["All"])            -> uppercases the whole string
Defensive patterns

Strategy: validation

Validate before calling

if (!Array.isArray(args) || args.length === 0) {
  throw new Error("To Upper Case requires a scope argument");
}

Type guard

const hasScope = args => Array.isArray(args) && args.length > 0 && ["All","Word","Sentence","Paragraph"].includes(args[0]);

Try / catch

try { toUpperCase(input, args); }
catch (e) { if (/capitalization scope/.test(e.message)) { args = ["All"]; } else throw e; }

Prevention

When it happens

Trigger: Calling the operation with no args, an empty args array, or null args — typically only possible via a programmatic recipe or a malformed config, since the UI always supplies a default option.

Common situations: Programmatically constructing a recipe and omitting the scope argument; a corrupted recipe config that lost the argument list; calling the operation directly in tests without args.

Related errors


AI-assisted analysis of gchq/CyberChef@4290ea7539 (2026-08-13). Data as JSON: /api/errors/4312637451f29628. Report an issue: GitHub.