d2phap/ImageGlass · error · InvalidDataException

IGE: Native codec '{proxy.CodecId}' returned status {status}

Error message

IGE: Native codec '{proxy.CodecId}' returned status {status} for GetAnimationInfo of '{metadata.FilePath}'.

What it means

Thrown by NativePluginAnimator.Create when the plugin's GetAnimationInfo returns an IGStatus other than OK (Canceled routes to cancellation instead). The plugin ran but reported a failure code; the status value is interpolated so the caller can see whether it was InvalidData, Unsupported, OutOfMemory, etc.

Source

Thrown at source/ImageGlass.Lib/Plugins/NativePluginAnimator.cs:104

                    var pathRef = new IGStringRef { Data = pPath, Length = metadata.FilePath.Length };
                    status = codecApi->GetAnimationInfo(pathRef, &info, (void*)cancelHandle);
                }
            }
            catch (Exception ex)
            {
                proxy.FailureManager.RecordSoftFailure(proxy.Plugin.PluginId,
                    $"managed exception during GetAnimationInfo: {ex.Message}");
                throw new InvalidDataException(
                    $"IGE: Native codec '{proxy.CodecId}' threw during GetAnimationInfo of '{metadata.FilePath}'.", ex);
            }

            if (status == IGStatus.Canceled)
            {
                token.ThrowIfCancellationRequested();
            }
            if (status != IGStatus.OK)
            {
                throw new InvalidDataException(
                    $"IGE: Native codec '{proxy.CodecId}' returned status {status} for GetAnimationInfo of '{metadata.FilePath}'.");
            }
            infoOwned = true;

            if (info.FrameCount <= 0 || info.Frames == null)
            {
                throw new InvalidDataException(
                    $"IGE: Native codec '{proxy.CodecId}' reported zero frames for '{metadata.FilePath}'.");
            }

            // PHASE 2: copy per-frame timing into the SKCodecFrameInfo[] expected by AnimatorImpl.
            // Only Duration + AlphaType are meaningful here -- the host does not composite.
            var frames = new SKCodecFrameInfo[info.FrameCount];
            for (var i = 0; i < info.FrameCount; i++)
            {
                var f = info.Frames[i];
                frames[i] = new SKCodecFrameInfo
                {

View on GitHub (pinned to 4a3c4fecef)

Solutions

  1. Map the IGStatus code to its meaning (InvalidData → not a valid animated file, Unsupported → feature not supported) and route accordingly.
  2. Verify the file is genuinely animated and not a still image routed to the animator by mistake (check the codec's animation-capability gate).
  3. Try opening the file in another viewer; if valid, the plugin may not support that animated variant — report upstream.
  4. Fall back to treating it as a single-frame image (skip animator creation) if GetAnimationInfo reports Unsupported.

Example fix

// before
if (status != IGStatus.OK)
    throw new InvalidDataException($"IGE: Native codec '{proxy.CodecId}' returned status {status} for GetAnimationInfo of '{metadata.FilePath}'.");

// after — downgrade Unsupported to a non-animated decode instead of throwing
if (status == IGStatus.Unsupported)
    return null; // caller falls back to static decode
if (status != IGStatus.OK)
    throw new InvalidDataException($"IGE: Native codec '{proxy.CodecId}' returned status {status} for GetAnimationInfo of '{metadata.FilePath}'.");
Defensive patterns

Strategy: try-catch

Validate before calling

// Confirm the file is genuinely animated before requesting animation info.
if (!metadata.IsAnimated) return null; // static decode path

Try / catch

try { return NativePluginAnimator.Create(proxy, metadata, token); }
catch (InvalidDataException ex) when (ex.Message.Contains("returned status") && ex.Message.Contains("GetAnimationInfo"))
{ _log.Warn($"Plugin status on animation info: {ex.Message}; falling back to static."); return null; }

Prevention

When it happens

Trigger: Produced at NativePluginAnimator.cs:104 when status != IGStatus.OK after the GetAnimationInfo native call. Reached when the host asks for animation info on a file the plugin cannot parse as animated.

Common situations: A still image misidentified as animated (codec routed to the animator path for a non-animated file); a malformed/truncated animated file; an animated sub-format the plugin does not support (e.g. an APNG in a GIF-only plugin); the file is not actually in the plugin's expected format despite the extension.

Related errors


AI-assisted analysis of d2phap/ImageGlass@4a3c4fecef (2026-08-13). Data as JSON: /api/errors/543109477ea9bf01. Report an issue: GitHub.