gchq/CyberChef · error · OperationError

Rotor ${i} must be provided.

Error message

Rotor ${i} must be provided.

What it means

Thrown by the Typex operation's parseRotorStr helper when one of the five rotor specification strings (args[0], args[4], args[8], args[12], args[16]) is the empty string. Each rotor arg is an editableOption whose value is a wiring spec optionally followed by '<' and stepping points; an empty value cannot define a rotor.

Source

Thrown at src/core/operations/Typex.mjs:173

                name: "Strict output",
                hint: "Remove non-alphabet letters and group output",
                type: "boolean",
                value: true
            },
        ];
    }

    /**
     * Helper - for ease of use rotors are specified as a single string; this
     * method breaks the spec string into wiring and steps parts.
     *
     * @param {string} rotor - Rotor specification string.
     * @param {number} i - For error messages, the number of this rotor.
     * @returns {string[]}
     */
    parseRotorStr(rotor, i) {
        if (rotor === "") {
            throw new OperationError(`Rotor ${i} must be provided.`);
        }
        if (!rotor.includes("<")) {
            return [rotor, ""];
        }
        return rotor.split("<", 2);
    }

    /**
     * @param {string} input
     * @param {Object[]} args
     * @returns {string}
     */
    run(input, args) {
        const reflectorstr = args[20];
        const plugboardstr = args[21];
        const typexKeyboard = args[22];
        const removeOther = args[23];
        const rotors = [];

View on GitHub (pinned to 4290ea7539)

Solutions

  1. Restore a non-empty rotor value: select one of the built-in ROTORS from the dropdown.
  2. If defining a custom rotor, enter the 26-letter wiring string (optionally '<' + steps).
  3. Check saved recipe JSON for empty rotor fields and repopulate them.
Defensive patterns

Strategy: validation

Validate before calling

for (let i = 0; i < 5; i++) {
  const rotor = args[i * 4];
  if (!rotor || rotor === "") {
    throw new Error(`Rotor ${i} must not be empty`);
  }
}

Type guard

function rotorsAreProvided(args) { return [0,4,8,12,16].every(i => typeof args[i] === "string" && args[i] !== ""); }

Prevention

When it happens

Trigger: Clearing/customising a rotor editableOption to an empty string, or loading a recipe/saved state where a rotor field was blanked. The i in the message is the 1-based-ish rotor index from the loop in run().

Common situations: User deletes the rotor wiring text in the UI to start typing a custom rotor and runs before finishing, or imports a recipe whose rotor fields did not survive serialisation.

Related errors


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