gchq/CyberChef · error · OperationError

Error loading image. (${err})

Error message

Error loading image. (${err})

What it means

After the isImage() pre-check passes, the operation calls Jimp.read(input). If Jimp cannot decode the buffer (unsupported codec, truncated data, or a false-positive magic byte), the catch block rethrows as OperationError with the underlying error message.

Source

Thrown at src/core/operations/BlurImage.mjs:63

    }

    /**
     * @param {ArrayBuffer} input
     * @param {Object[]} args
     * @returns {byteArray}
     */
    async run(input, args) {
        const [blurAmount, blurType] = args;

        if (!isImage(input)) {
            throw new OperationError("Invalid file type.");
        }

        let image;
        try {
            image = await Jimp.read(input);
        } catch (err) {
            throw new OperationError(`Error loading image. (${err})`);
        }
        try {
            switch (blurType) {
                case "Fast":
                    if (isWorkerEnvironment())
                        self.sendStatusMessage("Fast blurring image...");
                    image.blur(blurAmount);
                    break;
                case "Gaussian":
                    if (isWorkerEnvironment())
                        self.sendStatusMessage("Gaussian blurring image...");
                    image.gaussian(blurAmount);
                    break;
            }

            let imageBuffer;
            if (image.mime === "image/gif") {
                imageBuffer = await image.getBuffer(JimpMime.png);

View on GitHub (pinned to 4290ea7539)

Solutions

  1. Open the file in an image viewer to confirm it is intact.
  2. Re-encode the image to PNG/JPEG before passing it to BlurImage.
  3. Inspect err.message from the thrown OperationError for the specific decoder failure.
Defensive patterns

Strategy: try-catch

Try / catch

try { await blurImage.run(input, args); }
catch (e) { if (/Error loading image/.test(e.message)) { /* re-encode to PNG upstream */ } else throw e; }

Prevention

When it happens

Trigger: Jimp.read() rejects: input passes the rough isImage check but is corrupt or uses a format/variant Jimp's decoder cannot handle.

Common situations: Truncated image download; progressive/animated formats; exotic color profiles; file that starts with image magic bytes but is otherwise invalid.

Related errors


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