gchq/CyberChef · error · OperationError
Crib cannot be empty
Error message
Crib cannot be empty
What it means
Thrown by MultipleBombe.run when the crib (args[4]) is an empty string. The Bombe attack requires a known plaintext fragment (the 'crib') to build its menu; without one there is nothing to test rotor settings against.
Source
Thrown at src/core/operations/MultipleBombe.mjs:217
}
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;
const output = {bombeRuns: []};
// I could use a proper combinatorics algorithm here... but it would be more code to
// write one, and we don't seem to have one in our existing libraries, so massively nestedView on GitHub (pinned to 4290ea7539)
Solutions
- Enter a known-plaintext fragment in the Crib field (e.g. 'WETTER').
- Ensure the crib actually appears in the ciphertext at the given offset.
- Double-check the crib is not just whitespace — although note the check uses raw length, so whitespace passes but will be stripped later leaving an empty effective crib.
Example fix
// before
chef.bake("Multiple Bombe", [..., "", 0, true]);
// after
chef.bake("Multiple Bombe", [..., "WETTER", 0, true]); Defensive patterns
Strategy: validation
Validate before calling
const crib = args[4];
if (typeof crib !== "string" || crib.length === 0) {
// enter a known-plaintext fragment
} Type guard
const hasCrib = (c) => typeof c === "string" && c.replace(/[^A-Za-z]/g, "").length > 0;
Try / catch
try { chef.bake("Multiple Bombe", args); }
catch (e) { if (e.message === "Crib cannot be empty") enterCrib(); else throw e; } Prevention
- Always supply a crib known to appear in the ciphertext.
- Avoid whitespace-only cribs (they pass length but vanish after filtering).
- Validate the crib has at least one letter.
When it happens
Trigger: run(input, args) where args[4] === '' (the Crib field). Checked before the crib is uppercased/filtered, so any zero-length string trips it.
Common situations: User forgot to enter a crib; crib was in a different field; recipe loaded with the crib field blanked; crib consisted only of characters that were intended but never typed.
Related errors
- Rotor wiring must be 26 unique uppercase letters
- A minimum of three rotors must be supplied
- A minimum of one reflector must be supplied
- 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/b191c7ce6bfa8036.
Report an issue: GitHub.