gchq/CyberChef · error · OperationError
A minimum of one reflector must be supplied
Error message
A minimum of one reflector must be supplied
What it means
Thrown by MultipleBombe.run when the reflectors list ends up empty after splitting args[3] on newlines. At least one reflector is required because the Bombe loops over reflector choices. In practice this branch is hard to reach because even an empty string splits to [''] and the loop constructs one Reflector.
Source
Thrown at src/core/operations/MultipleBombe.mjs:214
}
if (rotors.length < 3) {
throw new OperationError("A minimum of three rotors must be supplied");
}
if (fourthRotorsStr !== "") {
for (let rstr of fourthRotorsStr.split("\n")) {
rstr = this.validateRotor(rstr);
fourthRotors.push(rstr);
}
}
if (fourthRotors.length === 0) {
fourthRotors.push("");
}
for (const rstr of reflectorsStr.split("\n")) {
const reflector = new Reflector(rstr);
reflectors.push(reflector);
}
if (reflectors.length === 0) {
throw new OperationError("A minimum of one reflector must be supplied");
}
if (crib.length === 0) {
throw new OperationError("Crib cannot be empty");
}
if (offset < 0) {
throw new OperationError("Offset cannot be negative");
}
// For symmetry with the Enigma op, for the input we'll just remove all invalid characters
input = input.replace(/[^A-Za-z]/g, "").toUpperCase();
crib = crib.replace(/[^A-Za-z]/g, "").toUpperCase();
const ciphertext = input.slice(offset);
let update;
if (isWorkerEnvironment()) {
update = this.updateStatus;
} else {
update = undefined;
}
let bombe = undefined;View on GitHub (pinned to 4290ea7539)
Solutions
- Provide at least one reflector wiring string (e.g. the standard B reflector 'YRUHQSLDPXNGOKMIEBFZCWVJAT').
- Ensure the reflectors argument is a string, never null or undefined.
- Restore default reflector values if the field was cleared.
Example fix
// before
chef.bake("Multiple Bombe", [..., reflectors="", ...]);
// after
chef.bake("Multiple Bombe", [..., reflectors="YRUHQSLDPXNGOKMIEBFZCWVJAT", ...]); Defensive patterns
Strategy: validation
Validate before calling
const reflectorsStr = args[3];
if (typeof reflectorsStr !== "string" || reflectorsStr.split("\n").length === 0) {
// supply a reflector string
} Type guard
const hasReflector = (s) => typeof s === "string" && s.length > 0;
Try / catch
try { chef.bake("Multiple Bombe", args); }
catch (e) { if (e.message === "A minimum of one reflector must be supplied") addReflector(); else throw e; } Prevention
- Always include at least the B reflector.
- Ensure reflectors arg is a non-empty string, never null.
- Restore defaults if the field was cleared.
When it happens
Trigger: run(input, args) where reflectors.length === 0 after the split/construct loop. Realistically reachable only if args[3] is something that produces no iterations (e.g. the reflector string is manipulated to yield an array that the for..of skips), since ''.split('\n') returns [''] and the loop runs once.
Common situations: Recipe where the reflectors field was set to null/undefined rather than a string; programmatic invocation passing a non-string reflectors argument; edge cases where a Reflector constructor throws and is caught upstream leaving the array empty (not the case in this code).
Related errors
- Rotor wiring must be 26 unique uppercase letters
- A minimum of three rotors must be supplied
- Crib cannot be empty
- Offset cannot be negative
- ${name} connects ${pair[1]} more than once
AI-assisted analysis of gchq/CyberChef@4290ea7539 (2026-08-13).
Data as JSON: /api/errors/2dfd3e9a4ca23998.
Report an issue: GitHub.