gchq/CyberChef · error · OperationError
Please provide an input.
Error message
Please provide an input.
What it means
Bzip2Compress requires at least one byte of input; an empty buffer has nothing to compress and the underlying emscripten module would error. The operation rejects empty input up front with a user-facing message.
Source
Thrown at src/core/operations/Bzip2Compress.mjs:53
max: 9
},
{
name: "Work factor",
type: "number",
value: 30
}
];
}
/**
* @param {ArrayBuffer} input
* @param {Object[]} args
* @returns {File}
*/
async run(input, args) {
const [blockSize, workFactor] = args;
if (input.byteLength <= 0) {
throw new OperationError("Please provide an input.");
}
if (isWorkerEnvironment()) self.sendStatusMessage("Loading Bzip2...");
return new Promise((resolve, reject) => {
Bzip2().then(bzip2 => {
if (isWorkerEnvironment()) self.sendStatusMessage("Compressing data...");
const inpArray = new Uint8Array(input);
const bzip2cc = bzip2.compressBZ2(inpArray, blockSize, workFactor);
if (bzip2cc.error !== 0) {
reject(new OperationError(bzip2cc.error_msg));
} else {
const output = bzip2cc.output;
resolve(output.buffer.slice(output.byteOffset, output.byteLength + output.byteOffset));
}
});
});
}
}View on GitHub (pinned to 4290ea7539)
Solutions
- Provide non-empty input to the operation.
- Guard the pipeline: skip compression when input.byteLength === 0.
- Check the upstream step that should have produced data.
Example fix
// before Bzip2Compress.run(emptyBuffer, args) // after Bzip2Compress.run(nonEmptyBuffer, args)
Defensive patterns
Strategy: validation
Validate before calling
if (!input || input.byteLength <= 0) throw new Error('Bzip2Compress needs non-empty input'); Type guard
function hasBytes(buf) { return buf && buf.byteLength > 0; } Prevention
- Skip compression for empty payloads.
- Verify the upstream operation produced output.
- Guard at the pipeline boundary.
When it happens
Trigger: Calling Bzip2Compress.run with an input ArrayBuffer whose byteLength is <= 0.
Common situations: Upstream operation produced empty output; user submitted an empty file; pipeline wired to an empty source.
Related errors
- Please provide an input.
- Data is not a valid ${Dish.enumLookup(type)}: ${sample}
- ${this.name} cannot be empty.
- ${this.name} length cannot exceed ${this.maxLength}.
- ${this.name} must be a number.
AI-assisted analysis of gchq/CyberChef@4290ea7539 (2026-08-13).
Data as JSON: /api/errors/e577cddd5d96b523.
Report an issue: GitHub.