{"record":{"id":"0f3167f7a37d82fe","repo":"SixLabors/ImageSharp","slug":"one-of-apng-image-s-frames-do-not-have-a-frame-control-chunk","errorCode":null,"errorMessage":"One of APNG Image's frames do not have a frame control chunk.","messagePattern":"One of APNG Image's frames do not have a frame control chunk\\.","errorType":"exception","errorClass":"InvalidImageContentException","httpStatus":null,"severity":"error","filePath":"src/ImageSharp/Formats/Png/PngThrowHelper.cs","lineNumber":27,"sourceCode":"internal 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!\");\n\n    [DoesNotReturn]\n    public static void ThrowInvalidParameter(object value, string message, [CallerArgumentExpression(nameof(value))] string name = \"\")\n        => throw new NotSupportedException($\"Invalid {name}. {message}. Was '{value}'.\");\n\n    [DoesNotReturn]","sourceCodeStart":9,"sourceCodeEnd":45,"githubUrl":"https://github.com/SixLabors/ImageSharp/blob/59ce6af6fc29027cda277ef62d4d1694a8acce91/src/ImageSharp/Formats/Png/PngThrowHelper.cs#L9-L45","documentation":"Thrown when decoding an APNG where at least one animation frame lacks its fcTL (frame control) chunk. Every fdAT frame data chunk must be preceded by an fcTL declaring that frame's dimensions, offsets, and disposal/blend operations; without it the frame cannot be composited.","triggerScenarios":"Decoding an APNG whose frame-data chunks (fdAT) are not each preceded by an fcTL — files with dropped or reordered fcTL chunks, or frames appended by custom tools without control metadata.","commonSituations":"Animations edited by scripts that inserted fdAT data directly, files round-tripped through encoders that drop ancillary chunks, corrupted or partially truncated animation data.","solutions":["Re-encode the animation with a compliant APNG encoder so each frame has an fcTL before its fdAT.","If editing chunks programmatically, ensure every fdAT is immediately preceded by its fcTL with correct sequence numbers.","Validate with an APNG-aware checker before decoding.","Catch InvalidImageContentException to handle malformed animations."],"exampleFix":"// before (frame without control chunk)\nWriteChunk(fctl1); WriteChunk(fdat1); WriteChunk(fdat2);\n// after\nWriteChunk(fctl1); WriteChunk(fdat1); WriteChunk(fctl2); WriteChunk(fdat2);","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":"try\n{\n    using var image = Image.Load(stream);\n}\ncatch (InvalidImageContentException ex) when (ex.Message.Contains(\"frame control chunk\"))\n{\n    // APNG frame missing fcTL — reject or re-encode the animation\n}","preventionTips":["Ensure every fdAT chunk is preceded by an fcTL with correct sequence numbers.","Use established APNG tooling instead of hand-rolled frame insertion.","Validate animations with an APNG-aware validator."],"tags":["png","apng","fctl","frame-metadata"],"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"}