{"record":{"id":"b2b08a68bf3a608c","repo":"gchq/CyberChef","slug":"could-not-remove-exif-data-from-image-err","errorCode":null,"errorMessage":"Could not remove EXIF data from image: ${err}","messagePattern":"Could not remove EXIF data from image: (.+?)","errorType":"exception","errorClass":"OperationError","httpStatus":null,"severity":"error","filePath":"src/core/operations/RemoveEXIF.mjs","lineNumber":50,"sourceCode":"        this.args = [];\n    }\n\n    /**\n     * @param {ArrayBuffer} input\n     * @param {Object[]} args\n     * @returns {byteArray}\n     */\n    run(input, args) {\n        input = new Uint8Array(input);\n        // Do nothing if input is empty\n        if (input.length === 0) return input;\n\n        try {\n            return removeEXIF(input);\n        } catch (err) {\n            // Simply return input if no EXIF data is found\n            if (err === \"Exif not found.\") return input;\n            throw new OperationError(`Could not remove EXIF data from image: ${err}`);\n        }\n    }\n\n}\n\nexport default RemoveEXIF;\n","sourceCodeStart":32,"sourceCodeEnd":57,"githubUrl":"https://github.com/gchq/CyberChef/blob/4290ea753912378913b1f3f54e0fc5720afeda5d/src/core/operations/RemoveEXIF.mjs#L32-L57","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\n//   input: truncated JPEG bytes causing parser throw\n// after\n//   input: complete, well-formed JPEG with valid EXIF APP1 segment","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { return removeEXIFOp(input); } catch (e) { if (/Could not remove EXIF/.test(e.message)) { /* re-encode JPEG externally */ } else throw e; }","preventionTips":["Re-save images with standard encoders before stripping EXIF.","Verify JPEG integrity upstream.","Handle 'Exif not found' as a non-error (input returned unchanged)."],"tags":["image","exif","jpeg","validation"],"backgroundTag":null,"analyzedSha":"4290ea753912378913b1f3f54e0fc5720afeda5d","analyzedAt":"2026-08-13T06:05:50.210Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}