{"record":{"id":"5793e9bbd60c0361","repo":"gchq/CyberChef","slug":"could-not-extract-exif-data-from-image-err","errorCode":null,"errorMessage":"Could not extract EXIF data from image: ${err}","messagePattern":"Could not extract EXIF data from image: (.+?)","errorType":"exception","errorClass":"OperationError","httpStatus":null,"severity":"error","filePath":"src/core/operations/ExtractEXIF.mjs","lineNumber":57,"sourceCode":"     * @param {Object[]} args\n     * @returns {string}\n     */\n    run(input, args) {\n        try {\n            const parser = ExifParser.create(input);\n            const result = parser.parse();\n\n            const lines = [];\n            for (const tagName in result.tags) {\n                const value = result.tags[tagName];\n                lines.push(`${tagName}: ${value}`);\n            }\n\n            const numTags = lines.length;\n            lines.unshift(`Found ${numTags} tags.\\n`);\n            return lines.join(\"\\n\");\n        } catch (err) {\n            throw new OperationError(`Could not extract EXIF data from image: ${err}`);\n        }\n    }\n\n}\n\nexport default ExtractEXIF;\n","sourceCodeStart":39,"sourceCodeEnd":64,"githubUrl":"https://github.com/gchq/CyberChef/blob/4290ea753912378913b1f3f54e0fc5720afeda5d/src/core/operations/ExtractEXIF.mjs#L39-L64","documentation":"Thrown by the Extract EXIF operation when the exif-parser library raises any exception during parsing. The error wraps the underlying library message. EXIF data is metadata embedded in JPEG, TIFF, and some audio files. Parsing fails when the input is not a valid image with EXIF data or when the EXIF structure is malformed/corrupt.","triggerScenarios":"run(input, args) where ExifParser.create(input).parse() throws — e.g., input is not a valid image, has no EXIF segment, or contains a corrupt EXIF APP1 marker. The catch block at line 56 re-throws as OperationError.","commonSituations":"Feeding a PNG (which uses eXIf chunks, not APP1), a GIF, a text file, a truncated/corrupted JPEG, or an image whose EXIF was stripped. Also occurs with HEIC/RAW formats not supported by exif-parser.","solutions":["Verify the input is a JPEG or TIFF file that actually contains EXIF metadata.","Use a different extraction operation if the image format is not EXIF-based (e.g., PNG).","Check the wrapped error message for the specific library failure (e.g., 'Invalid EXIF', 'Could not find JFIF').","Try re-saving or repairing the image if EXIF is suspected corrupt."],"exampleFix":"// before: input = <PNG file ArrayBuffer> -> exif-parser throws\n\n// after: input = <JPEG file with EXIF APP1 segment>","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  const result = chef.extractEXIF(input);\n} catch (e) {\n  if (e.message.startsWith('Could not extract EXIF')) {\n    // Input may not be a JPEG/TIFF or has no EXIF; try alternative\n    console.warn('No EXIF data found:', e.message);\n  } else throw e;\n}","preventionTips":["Verify input is a JPEG or TIFF before running.","Use Extract Audio Metadata for broader metadata extraction.","Test with known EXIF-containing images first."],"tags":["image","exif","metadata","parse-error","input-validation"],"backgroundTag":null,"analyzedSha":"4290ea753912378913b1f3f54e0fc5720afeda5d","analyzedAt":"2026-08-13T06:05:50.210Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}