gchq/CyberChef · warning · OperationError
No data
Error message
No data
What it means
Thrown by the Frequency Distribution operation when the input ArrayBuffer is empty (data.length === 0). The operation computes per-byte percentages that divide by data length, so it refuses to run on zero bytes. This is a guard against a meaningless/NaN result rather than a data-corruption problem.
Source
Thrown at src/core/operations/FrequencyDistribution.mjs:50
"type": "boolean",
"value": true
},
{
"name": "Show ASCII",
"type": "boolean",
"value": true
}
];
}
/**
* @param {ArrayBuffer} input
* @param {Object[]} args
* @returns {json}
*/
run(input, args) {
const data = new Uint8Array(input);
if (!data.length) throw new OperationError("No data");
const distrib = new Array(256).fill(0),
percentages = new Array(256),
len = data.length;
let i;
// Count bytes
for (i = 0; i < len; i++) {
distrib[data[i]]++;
}
// Calculate percentages
let repr = 0;
for (i = 0; i < 256; i++) {
if (distrib[i] > 0) repr++;
percentages[i] = distrib[i] / len * 100;
}
View on GitHub (pinned to 4290ea7539)
Solutions
- Provide non-empty byte data as input.
- Check upstream operations are not producing empty output.
- If empty input is expected in your pipeline, skip this op conditionally.
Example fix
// before: empty buffer freq.run(new ArrayBuffer(0), args) // throws // after: guard upstream if (input.byteLength > 0) freq.run(input, args); else /* skip */
Defensive patterns
Strategy: validation
Validate before calling
// Skip the op on empty input rather than letting it throw
if (input instanceof ArrayBuffer && input.byteLength === 0) {
// return empty result; do not call freq.run()
} Type guard
function hasBytes(buf) {
return (buf instanceof ArrayBuffer ? buf.byteLength : buf?.byteLength ?? 0) > 0;
} Try / catch
try {
freq.run(input, args);
} catch (e) {
if (e.type === 'OperationError' && e.message === 'No data') {
// empty input; produce an empty/zero distribution instead
} else throw e;
} Prevention
- Gate the operation on non-empty input in your pipeline.
- Check upstream filter/remove ops do not zero out the buffer.
- Handle 'No data' as an expected empty-input case, not a crash.
When it happens
Trigger: Feeding an empty input into the operation; an upstream op producing a zero-length ArrayBuffer; a recipe whose input was fully consumed/filtered out before this step.
Common situations: Empty recipe input box; a 'Remove'/'Filter' operation that deleted all bytes; feeding a string input that converted to zero bytes; testing the op with no data.
Related errors
- Input cannot be empty.
- Please provide an input.
- Invalid input file type.
- Error translating from ${Dish.enumLookup(this.type)} to Arra
- Error: Invalid Base64 input length (${data.length}). Cannot
AI-assisted analysis of gchq/CyberChef@4290ea7539 (2026-08-13).
Data as JSON: /api/errors/41859654192bdbdd.
Report an issue: GitHub.