{"record":{"id":"10465d652af7f491","repo":"SixLabors/ImageSharp","slug":"apng-image-does-not-contain-a-default-data-chunk","errorCode":null,"errorMessage":"APNG Image does not contain a default data chunk.","messagePattern":"APNG Image does not contain a default data chunk\\.","errorType":"exception","errorClass":"InvalidImageContentException","httpStatus":null,"severity":"error","filePath":"src/ImageSharp/Formats/Png/PngThrowHelper.cs","lineNumber":21,"sourceCode":"\nusing System.Diagnostics.CodeAnalysis;\nusing System.Runtime.CompilerServices;\n\nnamespace SixLabors.ImageSharp.Formats.Png;\n\ninternal static class PngThrowHelper\n{\n    [DoesNotReturn]\n    public static void ThrowInvalidImageContentException(string errorMessage) => throw new InvalidImageContentException(errorMessage);\n\n    [DoesNotReturn]\n    public static void ThrowInvalidHeader() => throw new InvalidImageContentException(\"PNG Image must contain a header chunk and it must be located before any other chunks.\");\n\n    [DoesNotReturn]\n    public static void ThrowNoData() => throw new InvalidImageContentException(\"PNG Image does not contain a data chunk.\");\n\n    [DoesNotReturn]\n    public static void ThrowMissingDefaultData() => throw new InvalidImageContentException(\"APNG Image does not contain a default data chunk.\");\n\n    [DoesNotReturn]\n    public static void ThrowInvalidAnimationControl() => throw new InvalidImageContentException(\"APNG Image must contain a acTL chunk and it must be located before any IDAT and fdAT chunks.\");\n\n    [DoesNotReturn]\n    public static void ThrowMissingFrameControl() => throw new InvalidImageContentException(\"One of APNG Image's frames do not have a frame control chunk.\");\n\n    [DoesNotReturn]\n    public static void ThrowMissingPalette() => throw new InvalidImageContentException(\"PNG Image does not contain a palette chunk.\");\n\n    [DoesNotReturn]\n    public static void ThrowInvalidChunkType() => throw new InvalidImageContentException(\"Invalid PNG data.\");\n\n    [DoesNotReturn]\n    public static void ThrowInvalidChunkType(string message) => throw new InvalidImageContentException(message);\n\n    [DoesNotReturn]\n    public static void ThrowInvalidChunkCrc(string chunkTypeName) => throw new InvalidImageContentException($\"CRC Error. PNG {chunkTypeName} chunk is corrupt!\");","sourceCodeStart":3,"sourceCodeEnd":39,"githubUrl":"https://github.com/SixLabors/ImageSharp/blob/59ce6af6fc29027cda277ef62d4d1694a8acce91/src/ImageSharp/Formats/Png/PngThrowHelper.cs#L3-L39","documentation":"Thrown when decoding an APNG (animated PNG) that declares animation but lacks the default image data chunk (IDAT, or an fdAT with sequence number 0 acting as the default frame). The APNG spec requires a default image that all frames are composited over.","triggerScenarios":"Decoding an APNG containing acTL and fcTL/fdAT chunks but no default image data; files where the default frame's fcTL and IDAT were stripped while animation metadata remained.","commonSituations":"APNGs produced by tools that only emit animation frames, files edited to remove the still image but not the animation metadata, corrupted animation exports.","solutions":["Re-generate the APNG ensuring a valid default image (IDAT with preceding fcTL of seq 0) is present.","Re-encode the animation with a spec-compliant tool (e.g. ffmpeg -plays 0 output, apngasm).","If a still image is expected, check whether the input is really an APNG and decode the intended variant.","Catch InvalidImageContentException to fall back to alternative handling."],"exampleFix":"// before (ffmpeg, missing default image)\nffmpeg -i frames%d.png -plays 0 out.png\n// after\nffmpeg -i frame0.png -i frames%d.png -plays 0 out.png // frame0 supplies the default IDAT","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":"try\n{\n    using var image = Image.Load(stream);\n}\ncatch (InvalidImageContentException ex) when (ex.Message.Contains(\"default data chunk\"))\n{\n    // malformed APNG — fall back to an alternate source or placeholder\n}","preventionTips":["Generate APNGs only with spec-compliant encoders (apngasm, ffmpeg with default image).","Do not strip IDAT from APNG files when editing chunk data.","Validate APNG structure with a dedicated checker before decoding."],"tags":["png","apng","animation","missing-chunk"],"backgroundTag":"invalid-image-content","analyzedSha":"59ce6af6fc29027cda277ef62d4d1694a8acce91","analyzedAt":"2026-09-13T18:34:59.331Z","contentChangedAt":"2026-09-13T18:34:59.331Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}