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 LSB (steganography) operation when isImage(input) returns false. The operation reads pixel RGBA data using Jimp and needs a valid image (PNG, JPEG, BMP). If the input ArrayBuffer does not match a recognized image file signature, the operation cannot proceed.
Source
Thrown at src/core/operations/ExtractLSB.mjs:73
type: "option",
value: ["Row", "Column"],
},
{
name: "Bit",
type: "number",
value: 0,
},
];
}
/**
* @param {ArrayBuffer} input
* @param {Object[]} args
* @returns {byteArray}
*/
async run(input, args) {
if (!isImage(input))
throw new OperationError("Please enter a valid image file.");
const bit = 7 - args.pop(),
pixelOrder = args.pop(),
colours = args
.filter((option) => option !== "")
.map((option) => COLOUR_OPTIONS.indexOf(option)),
parsedImage = await Jimp.read(input),
width = parsedImage.bitmap.width,
height = parsedImage.bitmap.height,
rgba = parsedImage.bitmap.data;
if (bit < 0 || bit > 7) {
throw new OperationError(
"Error: Bit argument must be between 0 and 7",
);
}
let i,View on GitHub (pinned to 4290ea7539)
Solutions
- Provide a valid image file (PNG, JPEG, or BMP) as the input ArrayBuffer.
- Verify the file is not truncated or corrupted by opening it in an image viewer first.
- Convert unsupported formats to PNG/JPEG before feeding to this operation.
- Ensure no upstream operation changes the data type away from ArrayBuffer.
Example fix
// before: input = <text file ArrayBuffer> -> isImage false -> error // after: input = <PNG image ArrayBuffer>
Defensive patterns
Strategy: type-guard
Validate before calling
// Verify input is an image before calling ExtractLSB
import { isImage } from '../lib/FileType.mjs';
if (!isImage(input)) {
throw new Error('Input must be a valid image file');
} Type guard
function isValidImage(input) {
// Delegates to CyberChef's FileType.isImage
return isImage(input);
} Prevention
- Always provide a valid PNG/JPEG/BMP image as input.
- Verify the image opens in a viewer before processing.
- Ensure upstream operations output ArrayBuffer.
When it happens
Trigger: async run(input, args) where isImage(input) returns false at line 72. Input is expected to be an ArrayBuffer containing image bytes but either is not an image or is not a supported format.
Common situations: Feeding a non-image file (text, PDF, audio), a corrupted/truncated image, or an unsupported image format (e.g., WebP, HEIC depending on Jimp version). Also when an upstream operation outputs non-ArrayBuffer data.
Related errors
- Error: Bit argument must be between 0 and 7
- Please enter a valid image file.
- Invalid file type.
- Invalid file format.
- Invalid file type.
AI-assisted analysis of gchq/CyberChef@4290ea7539 (2026-08-13).
Data as JSON: /api/errors/59112b635937c705.
Report an issue: GitHub.