{"record":{"id":"b7f28804ed80536a","repo":"SixLabors/ImageSharp","slug":"the-ani-file-does-not-contain-any-identifiable-animation","errorCode":null,"errorMessage":"The ANI file does not contain any identifiable animation steps.","messagePattern":"The ANI file does not contain any identifiable animation steps\\.","errorType":"exception","errorClass":"InvalidImageContentException","httpStatus":null,"severity":"error","filePath":"src/ImageSharp/Formats/Ani/AniDecoderCore.cs","lineNumber":224,"sourceCode":"                // Some embedded decoders expose only resource-level dimensions, so synthesize the one required ANI frame entry.\n                ImageFrameMetadata target = new();\n                target.SetFormatMetadata(AniFormat.Instance, CreateFrameMetadata(null, format, step + 1, frameDelay, info.Size));\n                outputFrames.Add(target);\n                continue;\n            }\n\n            for (int i = 0; i < info.FrameMetadataCollection.Count && outputFrames.Count < maxFrames; i++)\n            {\n                ImageFrameMetadata source = info.FrameMetadataCollection[i];\n                ImageFrameMetadata target = new();\n                target.SetFormatMetadata(AniFormat.Instance, CreateFrameMetadata(source, format, step + 1, frameDelay, info.Size));\n                outputFrames.Add(target);\n            }\n        }\n\n        if (outputFrames.Count is 0)\n        {\n            throw new InvalidImageContentException(\"The ANI file does not contain any identifiable animation steps.\");\n        }\n\n        return new ImageInfo(this.Dimensions, this.imageMetadata, outputFrames);\n    }\n\n    /// <summary>\n    /// Parses the RIFF container and records frame-list boundaries for subsequent embedded decoding.\n    /// </summary>\n    /// <param name=\"stream\">The ANI stream.</param>\n    private void ParseContainer(BufferedReadStream stream)\n    {\n        // Parser-owned chunk state is replaced by the container currently being scanned.\n        this.frameLists.Clear();\n        this.sequence?.Dispose();\n        this.rates?.Dispose();\n        this.sequence = null;\n        this.rates = null;\n","sourceCodeStart":206,"sourceCodeEnd":242,"githubUrl":"https://github.com/SixLabors/ImageSharp/blob/59ce6af6fc29027cda277ef62d4d1694a8acce91/src/ImageSharp/Formats/Ani/AniDecoderCore.cs#L206-L242","documentation":"After projecting all animation steps during identification, the decoder requires at least one identifiable step to build the returned ImageInfo. If every step was skipped (invalid sequence references, undecodable resources) the identification has no meaningful frame metadata and throws InvalidImageContentException. This is the identification-path counterpart of the decode-time 'no decodable animation steps' error.","triggerScenarios":"Calling Image.IdentifyAsync on an ANI stream where zero steps survive: fully-invalid 'seq ' chunk, all resources failed to parse, or steps array empty.","commonSituations":"Badly truncated ANI downloads; container files whose icon payloads were stripped; misidentified non-ANI streams reaching the ANI decoder.","solutions":["Validate the ANI file integrity (RIFF size vs actual size) before identification; re-obtain the file if truncated.","Re-export the cursor/animation ensuring 'fram'/'icon' chunks contain valid image data.","Catch InvalidImageContentException around Identify and treat the file as unidentifiable rather than ANI."],"exampleFix":"// before\nIImageInfo info = await Image.IdentifyAsync(stream);\n// after\ntry { IImageInfo info = await Image.IdentifyAsync(stream); }\ncatch (InvalidImageContentException ex) { Log(ex); return null; }","handlingStrategy":"try-catch","validationCode":"// Require both RIFF/ACON signature and a minimum size before identification\nbool candidate = new FileInfo(path).Length >= 64;","typeGuard":null,"tryCatchPattern":"try\n{\n    IImageInfo info = await Image.IdentifyAsync(stream);\n}\ncatch (InvalidImageContentException)\n{\n    return null; // no identifiable animation steps\n}","preventionTips":["Check file integrity (size vs RIFF declared size) before identification.","Avoid feeding stripped or partially rebuilt ANI files into Identify.","Cache known-good ANI files and verify hashes after download."],"tags":["ani","image-identification","empty-input","corrupt-file"],"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"}