gchq/CyberChef · error · OperationError

Please provide an input.

Error message

Please provide an input.

What it means

Bzip2Decompress requires a non-empty bzip2 stream; an empty buffer cannot be a valid compressed input. The operation rejects empty input before loading the wasm module.

Source

Thrown at src/core/operations/Bzip2Decompress.mjs:53

        ];
        this.checks = [
            {
                "pattern": "^\\x42\\x5a\\x68",
                "flags": "",
                "args": []
            }
        ];
    }

    /**
     * @param {byteArray} input
     * @param {Object[]} args
     * @returns {string}
     */
    async run(input, args) {
        const [small] = 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("Decompressing data...");
                const inpArray = new Uint8Array(input);
                const bzip2cc = bzip2.decompressBZ2(inpArray, small ? 1 : 0);
                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

  1. Supply a valid bzip2-compressed byte stream.
  2. Skip the operation when input.byteLength === 0.
  3. Verify the source produced the expected .bz2 bytes.

Example fix

// before
Bzip2Decompress.run(emptyArray, args)
// after
Bzip2Decompress.run(bz2Bytes, args)
Defensive patterns

Strategy: validation

Validate before calling

if (!input || input.byteLength <= 0) throw new Error('Bzip2Decompress needs non-empty input');

Type guard

function hasBytes(arr) { return arr && arr.byteLength > 0; }

Prevention

When it happens

Trigger: Calling Bzip2Decompress.run with an input byte array whose byteLength is <= 0.

Common situations: Empty file fed in; upstream decode/transfer step dropped all bytes; wrong operation wired before this one.

Related errors


AI-assisted analysis of gchq/CyberChef@4290ea7539 (2026-08-13). Data as JSON: /api/errors/af40dd535025d75c. Report an issue: GitHub.