gchq/CyberChef · error · OperationError
Crib cannot be empty
Error message
Crib cannot be empty
What it means
The Bombe attack requires a known-plaintext 'crib' to test against ciphertext. If the crib argument is empty after extraction, the operation cannot form any hypothesis and throws immediately, before rotor setup.
Source
Thrown at src/core/operations/Bombe.mjs:135
const offset = args[7];
const check = args[8];
const rotors = [];
for (let i=0; i<4; i++) {
if (i === 0 && model === "3-rotor") {
// No fourth rotor
continue;
}
let rstr = args[i + 1];
// The Bombe doesn't take stepping into account so we'll just ignore it here
if (rstr.includes("<")) {
rstr = rstr.split("<", 2)[0];
}
rotors.push(rstr);
}
// Rotors are handled in reverse
rotors.reverse();
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);
const reflector = new Reflector(reflectorstr);
let update;
if (isWorkerEnvironment()) {
update = this.updateStatus;
} else {
update = undefined;
}
const bombe = new BombeMachine(rotors, reflector, ciphertext, crib, check, update);
const result = bombe.run();
return {View on GitHub (pinned to 4290ea7539)
Solutions
- Supply a non-empty crib (the suspected plaintext fragment) as an argument.
- Validate crib.length > 0 in the UI before allowing the recipe to run.
- Confirm the argument order matches the operation's ingList.
Example fix
// before crib = '' // after crib = 'WETTER'
Defensive patterns
Strategy: validation
Validate before calling
if (!crib || crib.length === 0) throw new Error('Crib is required for the Bombe'); Type guard
function hasCrib(c) { return typeof c === 'string' && c.length > 0; } Prevention
- Require a non-empty crib in the UI before enabling run.
- Bind the crib argument explicitly from the recipe.
- Educate users that the Bombe needs known plaintext.
When it happens
Trigger: Calling Bombe.run with an empty crib argument string (length 0 before any character filtering).
Common situations: User leaves the crib field blank; UI default empty string; the crib variable was not bound from the recipe.
Related errors
- Offset cannot be negative
- Invalid ciphertext length: ${originalLength} bytes. Must be
- No padding requested in ${mode} mode but input is not a 16-b
- With ECB or CBC modes, the input must be divisible into 16 b
- No padding requested but input length (${message.length} byt
AI-assisted analysis of gchq/CyberChef@4290ea7539 (2026-08-13).
Data as JSON: /api/errors/5a3b2dcb8bcf057a.
Report an issue: GitHub.