gchq/CyberChef · error · OperationError
Could not remove EXIF data from image: ${err}
Error message
Could not remove EXIF data from image: ${err} What it means
Thrown by RemoveEXIF when the underlying removeEXIF() parser raises an error other than the expected 'Exif not found.'. The expected 'Exif not found.' case is swallowed and the input returned unchanged; any other parse failure (malformed JPEG, missing APP1 marker, truncated segment) is rethrown wrapped with context.
Source
Thrown at src/core/operations/RemoveEXIF.mjs:50
this.args = [];
}
/**
* @param {ArrayBuffer} input
* @param {Object[]} args
* @returns {byteArray}
*/
run(input, args) {
input = new Uint8Array(input);
// Do nothing if input is empty
if (input.length === 0) return input;
try {
return removeEXIF(input);
} catch (err) {
// Simply return input if no EXIF data is found
if (err === "Exif not found.") return input;
throw new OperationError(`Could not remove EXIF data from image: ${err}`);
}
}
}
export default RemoveEXIF;
View on GitHub (pinned to 4290ea7539)
Solutions
- Confirm the input is a well-formed JPEG with EXIF data (re-save with a tool like exiftool/ImageMagick).
- If no EXIF is present, the operation already returns the input unchanged — verify you expected removal.
- Strip/re-write EXIF externally if the internal parser rejects the segment.
- Inspect err in the thrown message to locate the parser failure point.
Example fix
// before // input: truncated JPEG bytes causing parser throw // after // input: complete, well-formed JPEG with valid EXIF APP1 segment
Defensive patterns
Strategy: try-catch
Try / catch
try { return removeEXIFOp(input); } catch (e) { if (/Could not remove EXIF/.test(e.message)) { /* re-encode JPEG externally */ } else throw e; } Prevention
- Re-save images with standard encoders before stripping EXIF.
- Verify JPEG integrity upstream.
- Handle 'Exif not found' as a non-error (input returned unchanged).
When it happens
Trigger: Feeding a corrupted/truncated JPEG; a file that looks like JPEG but has a broken APP1/EXIF segment; an image format the EXIF parser partially accepts then fails on.
Common situations: Uploading an edited/re-saved image with a malformed EXIF block; truncated download; file that is actually not JPEG but starts with the JPEG signature.
Related errors
- Error opening image. (${err})
- Invalid file type.
- Invalid file type.
- Invalid file type.
- Could not extract EXIF data from image: ${err}
AI-assisted analysis of gchq/CyberChef@4290ea7539 (2026-08-13).
Data as JSON: /api/errors/b2b08a68bf3a608c.
Report an issue: GitHub.