gchq/CyberChef · error · OperationError

Please enter a valid image file.

Error message

Please enter a valid image file.

What it means

Thrown by the Extract RGBA operation when isImage(input) returns false. The operation reads each pixel's RGBA values using Jimp and requires a valid image file (PNG, JPEG, BMP). Without a recognized image signature, pixel data cannot be extracted.

Source

Thrown at src/core/operations/ExtractRGBA.mjs:52

                type: "editableOption",
                value: RGBA_DELIM_OPTIONS,
            },
            {
                name: "Include Alpha",
                type: "boolean",
                value: true,
            },
        ];
    }

    /**
     * @param {ArrayBuffer} input
     * @param {Object[]} args
     * @returns {string}
     */
    async run(input, args) {
        if (!isImage(input))
            throw new OperationError("Please enter a valid image file.");

        const delimiter = args[0],
            includeAlpha = args[1],
            parsedImage = await Jimp.read(input);

        let bitmap = parsedImage.bitmap.data;
        bitmap = includeAlpha ?
            bitmap :
            bitmap.filter((val, idx) => idx % 4 !== 3);

        return bitmap.join(delimiter);
    }
}

export default ExtractRGBA;

View on GitHub (pinned to 4290ea7539)

Solutions

  1. Provide a valid image file (PNG, JPEG, or BMP) as the input ArrayBuffer.
  2. Verify the image opens correctly in a standard viewer.
  3. Convert the image to a supported format if needed.
  4. Ensure the input reaches this operation as an ArrayBuffer.

Example fix

// before: input = <non-image ArrayBuffer> -> isImage false -> error

// after: input = <PNG/JPEG/BMP image ArrayBuffer>
Defensive patterns

Strategy: type-guard

Validate before calling

// Verify input is an image before calling ExtractRGBA
import { isImage } from '../lib/FileType.mjs';
if (!isImage(input)) {
  throw new Error('Input must be a valid image file');
}

Type guard

function isValidImage(input) {
  return isImage(input);
}

Prevention

When it happens

Trigger: async run(input, args) where isImage(input) returns false at line 51. Input must be an ArrayBuffer containing a supported image format.

Common situations: Feeding a non-image file, a corrupted image, or an unsupported format. Also occurs when upstream pipeline outputs non-image data or when the file is truncated.

Related errors


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